diff options
| author | salmonik <raisersoft@proton.me> | 2026-07-11 01:53:30 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-07-11 01:53:30 +0200 |
| commit | 3c98a57f94592b756b9794a2cc92b4bf3514dd0a (patch) | |
| tree | 84fa658865b28f9bdcd5386633b5dfd4ed281cfe | |
| parent | we have plans (diff) | |
| download | dungeon-3c98a57f94592b756b9794a2cc92b4bf3514dd0a.tar.gz dungeon-3c98a57f94592b756b9794a2cc92b4bf3514dd0a.zip | |
Create AGENTS.md
| -rw-r--r-- | AGENTS.md | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..14fee25 --- /dev/null +++ b/AGENTS.md | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | # AGENTS.md | ||
| 2 | |||
| 3 | ## Git discipline | ||
| 4 | |||
| 5 | **Every feature or fix gets its own branch.** Never work directly on `main`. | ||
| 6 | |||
| 7 | ### Starting work | ||
| 8 | ```sh | ||
| 9 | git checkout -b feat/<short-description> # new feature | ||
| 10 | git checkout -b fix/<short-description> # bug fix | ||
| 11 | ``` | ||
| 12 | |||
| 13 | ### Committing | ||
| 14 | - Commit after every meaningful, compiling change — small commits make rollbacks painless. | ||
| 15 | - Commit messages: imperative, lowercase, no period. E.g. `add attack animation`, `fix entity occlusion`. | ||
| 16 | - Never commit broken code. Run `cargo build` before every commit. | ||
| 17 | |||
| 18 | ### Before merging | ||
| 19 | ```sh | ||
| 20 | git checkout main | ||
| 21 | git merge --no-ff feat/<branch> # always a merge commit, preserves history | ||
| 22 | ``` | ||
| 23 | |||
| 24 | ### Rollbacks | ||
| 25 | - `git revert <sha>` to undo a specific commit without rewriting history. | ||
| 26 | - `git reset --hard <sha>` only on local branches you haven't pushed. | ||
| 27 | - If a branch goes off the rails, abandon it: `git checkout main && git branch -D feat/broken`. | ||
| 28 | |||
| 29 | ### Change tracking | ||
| 30 | - `git --no-pager log --oneline --graph` to visualise history. | ||
| 31 | - `git --no-pager diff main...feat/branch` to see what a branch adds before merging. | ||
| 32 | - Tags for milestones: `git tag -a v0.1 -m "turn-based loop + entities + combat"`. | ||
| 33 | |||
| 34 | --- | ||
| 35 | |||
| 36 | ## Project structure | ||
| 37 | |||
| 38 | ``` | ||
| 39 | src/ | ||
| 40 | ├── main.rs — window, input, game loop | ||
| 41 | ├── game.rs — game state, maze, entities, combat, inventory, animation | ||
| 42 | ├── renderer.rs — ray-caster, entity sprites, HUD, screen effects | ||
| 43 | └── texture.rs — procedural texture generation (wall, floor, exit) | ||
| 44 | docs/ | ||
| 45 | ├── PLAN.md — phased implementation plan | ||
| 46 | ├── CONTEXT.md — canonical domain glossary | ||
| 47 | └── adr/ — architecture decision records | ||
| 48 | ``` | ||
| 49 | |||
| 50 | ## Build & run | ||
| 51 | |||
| 52 | ```sh | ||
| 53 | cargo build # debug build | ||
| 54 | cargo build --release # release (no console on Windows) | ||
| 55 | cargo run # build + run | ||
| 56 | ``` | ||
| 57 | |||
| 58 | No external build tools — just `cargo`. | ||
| 59 | |||
| 60 | ## Code style | ||
| 61 | |||
| 62 | - Rust 2024 edition. | ||
| 63 | - No `ref mut` in patterns (2024 makes it implicit). | ||
| 64 | - `#[allow(dead_code)]` on deliberately unused scaffolding for future phases. | ||
| 65 | - Public fields only where needed by other modules; prefer private otherwise. | ||
| 66 | - Constants for magic numbers (`MOVE_DURATION`, `MAX_HP`, etc.). | ||
| 67 | - Messages use `.to_uppercase()` for display — the 5×5 font only has uppercase glyphs. | ||
| 68 | |||
| 69 | ## Design philosophy | ||
| 70 | |||
| 71 | - **Turn-based but smooth.** Player actions trigger discrete turns, but all movement is animated (180ms walk, 120ms turn, 120ms attack lunge). | ||
| 72 | - **One cell, one entity.** A grid cell holds at most one enemy, hallucination, or pickup. | ||
| 73 | - **The dungeon lies to you.** Hallucinations and fake pickups look real. Sanity controls how much the world gaslights the player. | ||
| 74 | - **Weakness is hunger, not a timer.** It drains HP to 1 at max, but only enemies can kill you. | ||
