diff --git a/docs/build.md b/docs/build.md index 8139ab3..28e57c3 100644 --- a/docs/build.md +++ b/docs/build.md @@ -27,7 +27,7 @@ For automatic rebuilds, install `watchexec` or `fswatch` and run: just dev ``` -`just run` starts the hot-reload loader in the foreground; use `just reload` manually from another terminal after editing `src/game`. `just dev` starts the loader in the background and keeps a file watcher running in the foreground to call `just reload` automatically when `src/game` changes. +`just run` starts the hot-reload loader in the foreground; use `just reload` manually from another terminal after editing `src/game` or `src/sim`. `just dev` starts the loader in the background and keeps a file watcher running in the foreground to call `just reload` automatically when either package changes. ## Release diff --git a/docs/tickets/001-architecture.md b/docs/tickets/001-architecture.md index 221083f..c180f68 100644 --- a/docs/tickets/001-architecture.md +++ b/docs/tickets/001-architecture.md @@ -10,22 +10,25 @@ The current `src/game` package is intentionally flat and almost empty. Before ad This ticket should not build gameplay. It should create the places gameplay will live. -## Proposed Shape +## Implemented Shape -Keep everything in the `game` package for now. Split by responsibility, not by abstraction layer. +Split platform-facing game code from deterministic simulation code. The `game` package owns Raylib, exported entry points, input sampling, and rendering. The `sim` package owns authoritative gameplay state, fixed-tick mutation, replay data, and world data. -Suggested files: +Current files: - `src/game/app.odin`: exported `game_*` API coordination and top-level update flow. - `src/game/memory.odin`: `Game_Memory` and long-lived allocations/state roots. -- `src/game/sim.odin`: fixed-step simulation types and entry points. -- `src/game/input.odin`: platform input sampling and normalized simulation commands. -- `src/game/replay.odin`: run input history, replay cursors, and deterministic replay helpers. -- `src/game/world.odin`: prototype world state, actors, rooms, and gameplay data. +- `src/game/input.odin`: platform input sampling into normalized simulation commands. +- `src/game/keymap.odin`: action-to-hardware binding configuration. - `src/game/render.odin`: rendering from simulation state. -- `src/game/config.odin`: constants and compile-time config. +- `src/game/config.odin`: window and app-facing compile-time config. +- `src/sim/sim.odin`: fixed-step simulation state and entry points. +- `src/sim/input.odin`: normalized simulation commands. +- `src/sim/replay.odin`: run input history, replay cursors, and deterministic replay helpers. +- `src/sim/world.odin`: prototype world state, actors, rooms, and gameplay data. +- `src/sim/config.odin`: simulation constants and replay-affecting config. -Exact names can change if implementation reveals a better split, but the ownership boundaries should remain clear. +The main boundary is that `src/sim` should stay free of Raylib, rendering, frame-time, and platform APIs so replay behavior can be tested without opening a window. ## Requirements @@ -39,7 +42,7 @@ Exact names can change if implementation reveals a better split, but the ownersh ## Acceptance Criteria -- `src/game` has a clear file structure for app lifecycle, simulation, input, replay, world, and rendering. +- `src/game` and `src/sim` have a clear file structure for app lifecycle, simulation, input, replay, world, and rendering. - `game_update` delegates to explicit update/render functions instead of owning all behavior inline. - `Game_Memory` is the only persistent root needed by the hot-reload API. - No gameplay behavior is implemented beyond what is necessary to keep the app running. diff --git a/justfile b/justfile index a28a0c5..cda9171 100644 --- a/justfile +++ b/justfile @@ -54,10 +54,10 @@ reload: build-game dev: build-game build-loader @if command -v watchexec >/dev/null 2>&1; then \ ./{{ hot_exe }} & \ - watchexec -w {{ game_pkg }} -e odin -- just reload; \ + watchexec -w {{ game_pkg }} -w {{ sim_pkg }} -e odin -- just reload; \ elif command -v fswatch >/dev/null 2>&1; then \ ./{{ hot_exe }} & \ - fswatch -o {{ game_pkg }} | while read -r _event; do just reload; done; \ + fswatch -o {{ game_pkg }} {{ sim_pkg }} | while read -r _event; do just reload; done; \ else \ printf "watchexec or fswatch is required for 'just dev'. Install one or use 'just run' + 'just reload'.\n"; \ exit 1; \