Layered Doom engine rewrite in Go with strict separation:
internal/domain- pure domain structures only.internal/application- services (use-cases).*/dto.go- DTO contracts are colocated with the layer/package that uses them.internal/infrastructure- binary parsers, adapters, converters.cmd/doom- bootstrap/CLI entrypoint.
- WAD ingestion pipeline:
BinaryReaderparses raw WAD binary into DTO.ArchiveConvertermaps DTO to domainArchive.loadiwad.Serviceorchestrates reading and conversion.
- Runtime pipeline:
rungame.Serviceorchestrates tick/controls/simulation/render flow.CommandMappermaps raw controls DTO into commands.DomainSimulation+HeadlessRendererprovide infrastructure adapters.
- Map pipeline:
loadmap.Serviceorchestrates map extraction and conversion.MapReaderextracts rawTHINGS/LINEDEFS/SIDEDEFS/VERTEXES/SECTORS.MapConvertermaps binary lumps to domainLevelmodel.
- Playable window pipeline:
playmap.Serviceapplies controls -> commands -> simulation each frame.ControlPollercollects keyboard state.FirstPersonRendererrenders walls in first-person perspective.TopDownRendererremains available via-topdownfor debug.LevelSimulationapplies collision against blocking linedefs and spawn orientation.
cmd/doom/main.gorunsLoad(ctx)and thenapp.Run(ctx, cfg.App, os.Stdout).cmd/doom/config.gocontains startup config loading/validation.internal/app/runner.gocontains runtime/bootstrap orchestration.
Config precedence (higher wins):
- CLI flags
- Environment variables (
DOOM_*) -configfile (orDOOM_CONFIG_PATH)configs/default.json- Code defaults
Supported env vars:
DOOM_CONFIG_PATHDOOM_IWAD_PATHDOOM_MAPDOOM_PLAYDOOM_TOPDOWNDOOM_WIDTHDOOM_HEIGHTDOOM_ZOOMDOOM_TICK_RATEDOOM_RUNTIME_TICKS
Run:
go run ./cmd/doom -iwad /path/to/doom1.wadRun with config file:
go run ./cmd/doom -config ./configs/dev.jsonRun headless runtime demo for 10 ticks:
go run ./cmd/doom -iwad /path/to/doom1.wad -runtime-ticks 10Parse one map from a WAD:
go run ./cmd/doom -iwad /path/to/doom1.wad -map E1M1Run playable map window:
go run ./cmd/doom -iwad /path/to/freedoom1.wad -map E1M1 -playFlags override config values. Example:
go run ./cmd/doom -config ./configs/dev.json -width 1600 -height 900Controls:
W/SorArrowUp/ArrowDown: move forward/backA/DorArrowLeft/ArrowRight: turn left/rightQ/E: strafe left/rightSpace,Ctrl, orLMB: fireEsc: quit