From 8fbde261e85d30817820338caa8d34686c520c46 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Thu, 3 Dec 2026 21:35:51 -0500 Subject: [PATCH] M5.1: remove road generation; spec change for worn paths (M5) Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- docs/manual-tests.md | 52 ++++++++++++++++- docs/milestones.md | 15 ++++- docs/spec.md | 32 ++++++++--- docs/verification-status.md | 7 +++ project.json | 108 ++++++++++++++++++++++++++++++++---- src/world.inc | 69 +---------------------- tools/check-people.ps1 | 2 +- tools/check-world.ps1 | 22 ++------ 9 files changed, 200 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index ed05313..9577e4a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Land Map 64 -A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as white dots, wander the world but are blocked by water and stone. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. +A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as white dots, wander the world but are blocked by water and stone. Where they walk often they wear dark brown paths into the land, which fade again when they are no longer used. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. - Targets: `c64` (details in [docs/spec.md](docs/spec.md)) - Language/toolchain: 6502 assembly (ca65) - Windows cross-development with cc65 (C, ca65 assembly or mixed) and VICE ([docs/toolchain.md](docs/toolchain.md)) diff --git a/docs/manual-tests.md b/docs/manual-tests.md index 751794f..86e5105 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -245,7 +245,7 @@ Start: `pwsh -File tools/run.ps1 -Target c64` Automated first: `pwsh -File tools/check-world.ps1 -Runs 10` should end with `[PASS] the terrain mix varies between worlds ...` and `[PASS] 10 world(s) checked.` (add `-ShowMap` to print each world as a character map: `.` land, `g` grass, `T` trees, -`#` stone, `~` water, roads `-` `|` with `+` crossings, bridges `=` `!` with `*` crossings). +`#` stone, `~` water; since M5.1 no roads). Steps: 1. Wait for the map (the generating message shows for about 4 seconds). Look at the first view. @@ -259,8 +259,8 @@ Expected: - Every view shows a mixture of terrain: open light brown land, green meadows with trees, grey rock outcrops and blue lakes with shores, spread over the whole world, not one big lake or a few patches. - Each new world has a different mix: some clearly wetter, rockier or greener than others. -- Black roads (two across, two down) run the full width and height of the world; where one crosses - water it continues as a bridge (black over blue), with no gap. +- (Before M5.1: black roads, two across and two down, with bridges over water. Since M5.1 there are + no generated roads; see MT5.1.) - No colour clash, no stray pixels at shores, bridges or crossings. - Dots walk on land, grass, trees, roads and bridges, and never step onto water or stone. On a bridge a dot stays on the black road and never touches the blue water on either side. @@ -278,3 +278,49 @@ Optional for this release. Use these steps when hardware is available. 2. Get the program onto a disk the machine can read, for example: copy the .prg (or .d64) to an SD2IEC/Pi1541/1541 Ultimate SD card; or write the .d64 to a real floppy with a ZoomFloppy/XUM1541 and OpenCBM (`d64copy build\.d64 8`). 3. On the machine: `LOAD"*",8` then `RUN` (a C128 in native mode can also use `RUN"name"`). For C64-mode targets on a C128, enter C64 mode first (`GO 64`, then `Y`). 4. Repeat the manual tests for the current milestone and note any difference from VICE (timing, colours, display artefacts, disk speed) in docs/verification-status.md. + +## M5 - Worn paths + +### MT5.1: No roads (c64) + +Setup: VICE x64sc, NTSC (-ntsc), pepto-pal palette (tools/run.ps1 selects it), warp off. +Start: `pwsh -File tools/run.ps1 -Target c64` + +Automated first: `pwsh -File tools/check-world.ps1 -Runs 10` should end with `[PASS] 10 world(s) checked.` + +Steps: +1. Wait for the map and scroll over the whole world. +2. Tap SPACE a few times and look again. + +Expected: +- No black roads or bridges anywhere; land, meadows with trees, grey rock and lakes as before. +- The dots walk as before. + +Verifies: R1 (R1.2, R1.3) + +### MT5.2: Worn paths (c64) + +Setup: VICE x64sc, NTSC (-ntsc), pepto-pal palette, warp off. +Start (test build: a path at 8 steps, gone again below 4, counts drop quickly): +`pwsh -File tools/run.ps1 -Target c64 -PathTest` +The normal build (`pwsh -File tools/run.ps1 -Target c64`) uses 128 and 64 with one count less +every 60 seconds, so paths there take many minutes of walking to appear. + +Automated first: `pwsh -File tools/check-paths.ps1` should end with `[PASS]`. + +Steps: +1. Start the test build and watch the first view for a minute without pressing keys. +2. Scroll around while paths appear and fade, and come back to the first view. +3. Press SPACE. +4. Optionally run the normal build for a long time (for example 30 minutes) and look for paths. + +Expected: +- Dark brown worn patches appear where the dots walk most, and turn back into the terrain they + were (light brown land, grass or trees) when the dots stop using them. +- Never on water or stone. +- No flicker, tearing, trails or wrong pixels when a cell changes, also while scrolling and where + a dot is standing on the cell. +- The dots keep walking over paths. +- SPACE gives a new world with no paths. + +Verifies: R7 diff --git a/docs/milestones.md b/docs/milestones.md index e99f2a5..ba287e7 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -67,4 +67,17 @@ Requirements: R1, R2, R5 |---|---|---|---|---| | M4.1 | Region generator: each world rolls its own terrain mix; jittered seeds on a grid give every class areas all over the world, shaped by noisy distances, smoothing and removal of thin water; shores from the neighbours; trees on grass. Roads stay a grid of two rows and two columns and become bridges over water. The scroll rebuild skips cells whose tile is already drawn, to keep the 8-frame rebuild with textured terrain everywhere. | R1, R2, R5 | Varied terrain in every view; SPACE gives a different mix | `pwsh -File tools/check-world.ps1 -Runs 10`, `tools/check-scroll.ps1 -Long`; manual test MT4.1 | -Manual verification: see docs/manual-tests.md section M4. \ No newline at end of file +Manual verification: see docs/manual-tests.md section M4. + +## M5 - Worn paths + +Goal: People wear paths into the land where they walk often; unused paths fade. + +Requirements: R7, R1, R2, R3, R5 + +| Task | Description | Requirements | Buildable outcome | Completion check | +|---|---|---|---|---| +| M5.1 | Remove road generation: the world has land, grass and trees, stone and water only; tools/check-world.ps1 fails on any road or bridge tile. | R1 | Worlds without roads | `pwsh -File tools/check-world.ps1 -Runs 10`; manual test MT5.1 | +| M5.2 | Worn paths: a walk count per cell (4,000 bytes), +1 when a person steps into a cell, -1 for every cell every 60 seconds (10 cells every 9 frames); at 128 a land, grass or tree cell becomes a path tile (dark brown patch, one per terrain so it can turn back), below 64 it turns back. Changed cells are redrawn in each buffer while it is hidden (people's dots and saved bytes kept), so the shown map never tears; a buffer in the middle of a rebuild restarts it in full. A test build (PATH_TEST: path at 8, back below 4, fast decay) makes it checkable. | R7, R2, R3, R5 | Busy cells turn into paths, unused paths fade | `pwsh -File tools/check-paths.ps1`, `tools/check-scroll.ps1 -Long`; manual test MT5.2 | + +Manual verification: see docs/manual-tests.md section M5. diff --git a/docs/spec.md b/docs/spec.md index 377fe2e..3258b9c 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -9,16 +9,17 @@ Changes approved by the user since then: - 2026-12-03: A4 status recorded from the M3.4 measurement as partly met; the user accepted the occasional one-frame scroll pause. - 2026-12-03: Background (land, border and status area) changed from brown (colour 9) to light brown: C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette (new assumption A8). Tree trunks stay colour 9. - 2026-12-03: Terrain all over the world ("the different land spaces need to be all over the map, not just here and there"): R1 reworded; new criteria R1.5 (every view shows at least three terrain kinds) and R1.6 (each world rolls its own random terrain mix). Roads stay a grid and cross water on bridges. New milestone M4. +- 2026-12-03: Worn paths instead of roads ("keep track of where the people walk and when the counter hits 128 then it is a path/road but the number can be reduced by one every certain number of cycles"; "remove their creation"): the generator makes no roads (R1 text, R1.2, R1.3); new R7 worn paths (dark brown patches, appear at 128, fade below 64, counts go down by one every 60 seconds, all chosen by the user); new milestone M5. ## Summary -A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as white dots, wander the world but are blocked by water and stone. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. +A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as white dots, wander the world but are blocked by water and stone. Where they walk often they wear dark brown paths into the land, which fade again when they are no longer used. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. Original idea, as given: > okay I want to start a c64 project in assembly that will procedurally generate a hi res color bitmap of a map of a land with brown land grey stone green grass and trees and black for roads colors. I would like to see if we can add people as tan dots and use buffer fliping to show movent of the people on the map .. you can ask me questions if this is not cleaar -Smallest useful version: A 2x2-screen world generated from a seed at start-up, shown one screen at a time in multicolour bitmap mode, pixel-smooth scrolling with the cursor keys, 16 white people moving over land, grass, trees and roads (not water or stone), flicker-free via two flipped buffers with only the people's spots redrawn, and SPACE for a new world. +Smallest useful version: A 2x2-screen world generated from a seed at start-up, shown one screen at a time in multicolour bitmap mode, pixel-smooth scrolling with the cursor keys, 16 white people moving over land, grass, trees and paths (not water or stone), flicker-free via two flipped buffers with only the people's spots redrawn, and SPACE for a new world. ## First release @@ -27,7 +28,7 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor ### In scope - Procedural generation of a 2x2-screen world (80x50 cells of 4x8 multicolour pixels) from a seed -- Terrain colours: light brown land (background), grey stone, green grass and trees, blue water, black roads that connect +- Terrain colours: light brown land (background), grey stone, green grass and trees, blue water, dark brown paths worn in by the people - Pixel-smooth scrolling of the view with the cursor keys, using the VIC-II fine-scroll registers and a double-buffered coarse shift - 16 people as white dots (one multicolour pixel each), spread over the world, blocked by water and stone; only those in view are drawn - Two bitmap buffers flipped once per update; only the bytes under people are restored and redrawn between scroll steps @@ -51,7 +52,7 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor | Target | Machine / mode | Display | Video | Artifact | Expected behavior | |---|---|---|---|---|---| -| `c64` | Commodore 64 | VIC-II 40x25 text/graphics screen (C64, or C128 40-column) | ntsc | `build/land-map-64.prg` | Autostarts, shows a short generating message, then a multicolour bitmap view of the world (20 rows): light brown land, grey stone, green grass and trees, blue water, black roads, with 5 lines of status text below it. White dots move on land and roads. Cursor keys scroll the view smoothly; SPACE generates a new world. | +| `c64` | Commodore 64 | VIC-II 40x25 text/graphics screen (C64, or C128 40-column) | ntsc | `build/land-map-64.prg` | Autostarts, shows a short generating message, then a multicolour bitmap view of the world (20 rows): light brown land, grey stone, green grass and trees, blue water, with 5 lines of status text below it. White dots move on the land and wear paths into it. Cursor keys scroll the view smoothly; SPACE generates a new world. | ### Dual-target and mode notes @@ -72,12 +73,12 @@ Each criterion is observable. Criteria IDs (for example R1.2) are referenced by ### R1 - Generated 2x2-screen world (must) -At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. Terrain covers the whole world: lakes, meadows with trees, rocky outcrops and open light brown land are spread all over it, not gathered in a few places. Each world rolls its own mix of the four terrain kinds (land, grass and trees, water, stone), so one world may be wet and another rocky. A grid of black roads (two across, two down) connects to each other and crosses water on bridges. The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6). +At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. Terrain covers the whole world: lakes, meadows with trees, rocky outcrops and open light brown land are spread all over it, not gathered in a few places. Each world rolls its own mix of the four terrain kinds (land, grass and trees, water, stone), so one world may be wet and another rocky. No roads are generated: paths appear where the people walk (R7). The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6). Acceptance criteria: - [R1.1] After autostart in VICE (x64sc, NTSC) the map view appears within 15 seconds -- [R1.2] Scrolling across the whole world shows all five terrain colours: light brown, grey, green, blue and black -- [R1.3] Roads are continuous black lines that connect to each other; where a road crosses water it is a bridge +- [R1.2] Scrolling across the whole world shows all four terrain colours: light brown, grey, green and blue +- [R1.3] The generated world has no roads: only land, grass and trees, stone and water (paths are worn in later, R7) - [R1.4] No colour clash: every 4x8 cell shows only its intended colours - [R1.5] Every 40x20-cell view of the world shows at least three of the four terrain kinds (land, grass and trees, water, stone), each covering at least 8 cells - [R1.6] Different worlds have different terrain mixes: over several SPACE presses, some worlds are visibly wetter, rockier or greener than others @@ -86,7 +87,7 @@ Capabilities: smooth-animation ### R2 - 16 moving people (must) -16 people, each a single white multicolour pixel, are spread over the world and move on their own. Water and stone block them: they walk only on land, grass, trees and roads. People inside the view are drawn; others keep moving unseen. +16 people, each a single white multicolour pixel, are spread over the world and move on their own. Water and stone block them: they walk only on land, grass, trees and paths. People inside the view are drawn; others keep moving unseen. Acceptance criteria: - [R2.1] Scrolling around the world shows 16 white dots in total @@ -139,6 +140,19 @@ Acceptance criteria: Capabilities: raster-interrupts +### R7 - Worn paths (must) + +Every cell of the world keeps a walk count. Each time a person steps into a cell its count goes up by one; every 60 seconds every count goes down by one. A land, grass or tree cell whose count reaches 128 becomes a path: a worn, dark brown patch. A path whose count falls below 64 turns back into the terrain it was. People walk on paths like on land. The counts and paths belong to the world: SPACE starts again with no paths. + +Acceptance criteria: +- [R7.1] Each time a person steps into a cell, that cell's walk count goes up by one (it stops at 255) +- [R7.2] Every 60 seconds every walk count goes down by one (it stops at 0) +- [R7.3] A land, grass or tree cell whose count reaches 128 becomes a dark brown path cell; the change appears in the map without flicker, tearing, trails or wrong pixels, also while the view scrolls and while people stand on it +- [R7.4] A path cell whose count falls below 64 turns back into the land, grass or trees it was +- [R7.5] People walk on paths; water and stone never become paths; SPACE gives a new world with all counts at 0 and no paths + +Capabilities: smooth-animation + ## Design decisions "Practical default" means the Foundry proposed it and the user accepted it without a specific preference. It can be changed later through AGENTS.md section 6. @@ -146,7 +160,7 @@ Capabilities: raster-interrupts | Topic | Decision | Source | |---|---|---| | Controls | Cursor keys scroll the view. On a real C64 these are CRSR down/right, plus SHIFT for up/left; the keyboard matrix is read directly so a key held down scrolls continuously. VICE maps the PC arrow keys to them. SPACE generates a new world. Known limitation (accepted by the user, 2026-12-03): SHIFT applies to both cursor keys, so only the Right + Down and Left + Up diagonals work; Up + Right and Down + Left come out as Up + Left (VICE sends the PC Up and Left arrows as SHIFT + CRSR). | decided by user | -| Visuals | Multicolour bitmap mode (160x200, double-wide pixels) for a 38-column map area 20 cell rows high, smooth-scrolled; below it a raster split to a fixed 5-row, 40-column text status area in the upper-case ROM font, white on light brown. Light brown (C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette) is the shared background colour; white is the colour-RAM colour in every cell, so people can be drawn anywhere without colour clash and colour RAM never needs scrolling. The two screen-RAM colours of each 4x8 cell come from grey (stone), green (grass and trees), blue (water) and black (roads). The world is stored as one tile byte per 4x8 cell; each tile is drawn from a small set of 8-byte pixel patterns (including edge and corner patterns) so shorelines and roads look natural. | decided by user | +| Visuals | Multicolour bitmap mode (160x200, double-wide pixels) for a 38-column map area 20 cell rows high, smooth-scrolled; below it a raster split to a fixed 5-row, 40-column text status area in the upper-case ROM font, white on light brown. Light brown (C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette) is the shared background colour; white is the colour-RAM colour in every cell, so people can be drawn anywhere without colour clash and colour RAM never needs scrolling. The two screen-RAM colours of each 4x8 cell come from grey (stone), green (grass and trees), blue (water) and dark brown (paths). The world is stored as one tile byte per 4x8 cell; each tile is drawn from a small set of 8-byte pixel patterns (including edge and corner patterns) so shorelines look natural. | decided by user | | Sound | None in the first release. | practical default | | Persistence (save/load) | None. Maps and seeds are not saved. | practical default | | File formats | None. A single PRG. | practical default | diff --git a/docs/verification-status.md b/docs/verification-status.md index 6390530..27fb55e 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -19,9 +19,16 @@ manual = `pending`, `confirmed by user ()`, `problem reported ():