JA
games/dmmotor / AGENTS.md · commit 9d248a4
# dmmotor — notes for agentsBuilt with JumPHP: **read `../../AGENTS.md` first**. This game is a port of id Software's GPL v2 engine(linuxdoom-1.10) to PHP, playing Freedoom Phase 1 or Phase 2 (chosen on the first screen). See `README.md` for the map of `src/Dm/`.## Rules of this project- **Licences**: `src/`, `tools/`, `tests/` are GPL v2 (`LICENSE`); keep the id Software copyright line and the  "after <file>.c" header in every ported file. `assets/wads/` is Freedoom (BSD): keep `COPYING.txt` / `CREDITS*`.  Never add id Software's commercial or shareware WADs. Never call the game by the original's trademark.- `src/Dm/Info.php` is generated: change `tools/gen-info.php`, not the file.- The WAD is split in 15 MB parts (the playground limits files to 20 MB): `php tools/split-wad.php <wad>`.- Floats everywhere (1.0 = one map unit, angles in radians); never 16.16 fixed point (32-bit ints in the browser).- `src/Dm` is plain PHP (`new`), excluded from the service container; `App\Service\DmGame` holds the shared state.- The level runs at 35 tics a second (`PlayScene::runTic`); short key presses are latched until the next tic.## Scenes`TitleScene` (choice of the game, TITLEPIC, menus from the WAD's M_* pictures, load game) → `PlayScene` (params `episode`, `map`, `skill`,`newGame`, `demo` = the self-playing bot of the smoke test) → `IntermissionScene` → next `PlayScene`, or`FinaleScene` (the story texts between levels, the end). `PauseScene` (JumPHP menu) over the game.## Checks```bashbin/jumphp test dmmotorJUMPHP_SCENE='App\Scene\PlayScene' JUMPHP_SCENE_PARAMS='{"demo":true,"episode":1,"map":1}' bin/jumphp shot dmmotor 400 var/screenshots/play.pngbin/jumphp build:remote dmmotor && JUMPHP_WEB=remote bin/jumphp webshot dmmotor 22 '[[3,"Enter"],[4,"Enter"],[5,"Enter"],[6,"Enter"],[7,"Enter"]]'```- Phase 2 = `DmGame::$commercial` / `World::$commercial` (MAPxx names, its monsters, super shotgun = WP 8).- Music: `Dm\Music` renders 22050 Hz mono in blocks; `DmGame::pumpMusic()` must be called every frame by the scene.- Save games serialize the whole `World` (without the WAD / graphics, given back by `World::attach()`).## Not done yetDemo playback (needs 16.16 fixed point everywhere), pointer lock for the mouse, multiplayer.