Преглед изворни кода

M5.1: remove road generation; spec change for worn paths (M5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Daniel Covington пре 2 дана
родитељ
комит
8fbde261e8
9 измењених фајлова са 200 додато и 109 уклоњено
  1. +1
    -1
      README.md
  2. +49
    -3
      docs/manual-tests.md
  3. +14
    -1
      docs/milestones.md
  4. +23
    -9
      docs/spec.md
  5. +7
    -0
      docs/verification-status.md
  6. +97
    -11
      project.json
  7. +3
    -66
      src/world.inc
  8. +1
    -1
      tools/check-people.ps1
  9. +5
    -17
      tools/check-world.ps1

+ 1
- 1
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))


+ 49
- 3
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\<image>.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

+ 14
- 1
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.
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.

+ 23
- 9
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 |


+ 7
- 0
docs/verification-status.md Прегледај датотеку

@@ -19,9 +19,16 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n
| M3.3 Fine scroll via $D016/$D011 in the 38-column, 20-row map area; rebuild the hidden buffer from tiles over 8 frames and flip on wrap; stop at world edges; show the view position in the status area; draw people relative to the view (in the shown buffer during vertical blank while a rebuild runs). | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,127 frames, 0 missed, update done by line 36; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 964 splits in 964 frames, all y-scroll values 0-7, starts 210:55-64, digits right after 240 of 240 status updates; `pwsh -File tools/check-scroll.ps1`: 3 of 3 scenarios, edges reached and held, 1-5 stall frames per scenario, both buffers byte-exact at the end) | confirmed by user (2026-12-03), after the fix for the reported tear ("the top of the screen tears a little when I go left or right") |
| M3.4 Check that people stay aligned with the terrain over long scrolling runs; measure the frame budget with a border-colour timing bar. | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,130 frames, update done by line 21; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 962 splits, digits 241/241; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 23,195 frames (about 6.4 minutes NTSC) with 21 stops byte-exact, people update done by line 45 at the latest; timing build `--asm-define TIMING_BAR` built and screenshot in VICE) | confirmed by user (2026-12-03), with the light brown background (colour 8, pepto-pal palette); dots visible |
| 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. | passed (2026-12-03, `pwsh -File tools/build.ps1` (4,647 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1 -Runs 10`: 10 of 10 worlds, every 40x20 view with 3+ terrain kinds, map ready 7.1-7.3 s after power-on (generation 4.0-4.1 s), mix spread land 14 / grass-trees 8 / water 13 / stone 16 percentage points; `pwsh -File tools/check-people.ps1`: 1,919 frames, 0 missed, update done by line 20; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 734 splits, digits right after 183 of 183 updates; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 22,966 frames with 21 stops byte-exact, 116 stall frames in 15,216 moving frames; fix for walking on bridge water, 2026-12-03: `pwsh -File tools/build.ps1` (4,683 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1` and `-Runs 10`: 10 of 10; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 3 of 3; `pwsh -File tools/check-people.ps1 -Cycles 300000000`: 17,119 frames, 1,408 person-frames on bridges, no dot on a blue or grey pixel; the same check fails on the old code (person 9 on a blue pixel of bridge tile 20); fix for the scroll that did not start, 2026-12-03: `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 4 of 4, new restart scenario 12 stall frames over four starts from a cell edge (the same scenario fails on the old code: 1,166 frames held left without moving); `pwsh -File tools/check-people.ps1`: 1,899 frames, 816 person-frames on bridges, pass; `pwsh -File tools/check-scroll.ps1 -Long`: 5 of 5, tour 22,967 frames with 21 stops byte-exact, 111 stall frames in 15,216 moving frames) | confirmed by user (2026-12-03), after two fixes: people walked on the blue water pixels of bridges, and the scroll sometimes did not start from rest on a cell edge |
| 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. | passed (2026-12-03, `pwsh -File tools/build.ps1` (4,581 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1` and `-Runs 10`: 10 of 10 worlds, no road or bridge cells; `pwsh -File tools/check-people.ps1`; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 4 of 4) | pending |
| M5.2 Worn paths: walk count per cell, path at 128, back below 64, one count less every 60 seconds. | not run - in progress | pending |

## Notes

- 2026-12-03 (spec change, approved by the user: worn paths instead of roads, new milestone M5):
- The user asked to track where people walk and turn a cell into a path when its count reaches 128, with counts going down by one now and then. Choices made by the user: a dark brown worn patch (not black road pieces), a path turns back below 64, one count less every 60 seconds, and no generated roads ("remove their creation").
- The unfinished M4.2 work (random winding roads with short bridges) was dropped before it was committed. It passed every check except the 5-minute scroll tour, which logged only 8,173 frames (cause not investigated). Its diff was kept outside the repository as a patch file.
- M5.1: src/world.inc no longer draws roads; the road and bridge tiles stay in src/tiles.inc, unused. tools/check-world.ps1 now fails on any road or bridge tile. tools/check-people.ps1: the expected-bitmap helper skipped people only from buffer row 21, but the saved bitmaps hold 20 rows, so a person in row 20 crashed the check (Index was outside the bounds of the array); it now skips row 20 too.

- 2026-12-03 (colour change, asked for by the user: "the people need to be white so they stick out"): colour RAM is now white (C64 colour 1) instead of light red (10), in src/main.s (COL_WHITE). Colour RAM is shared by the people (pixel %11) and the status text, and the partly visible bottom map row shares colour RAM row 20 with the first status line, so the user chose white status text too. Spec (R2, R3.2, R6, summary, A1), project.json, docs/milestones.md, docs/manual-tests.md, README.md and the check-split messages updated together. No check depends on the colour value.

- 2026-12-03 (spec note, decided by the user): the user found that Up + Right scrolls up and left. On the C64 SHIFT applies to both cursor keys (VICE sends the PC Up and Left arrows as SHIFT + CRSR), so Up + Right and Down + Left cannot be told apart from Up + Left. Offered extra letter keys or a joystick; the user chose to leave it as is. Recorded as a known limitation in docs/spec.md (Controls), project.json (controls) and docs/manual-tests.md (MT3.1 keys). No code change; docs/milestones.md unchanged (no task affected).


+ 97
- 11
project.json Прегледај датотеку

@@ -13,16 +13,18 @@
"Spec approved 2026-12-03 without changes; D1 (stone blocks people) left open at its default.",
"2026-12-03 change (approved): 5-line status area below a 20-row map via a raster split (R6); status readout in upper-case ROM text, light red; split task inserted as M3.2, old M3.2/M3.3 renumbered M3.3/M3.4.",
"2026-12-03 change (approved): R3 reworded so that while a scroll rebuild runs people are drawn in the shown buffer during vertical blank; drawing people relative to the view moved from M3.4 to M3.3.",
"2026-12-03 change (approved): background (land, border, status area) changed from brown (colour 9) to light brown: C64 colour 8 shown with VICE's pepto-pal palette, which tools/run.ps1 selects (assumption A8). Tree trunks stay colour 9."
"2026-12-03 change (approved): background (land, border, status area) changed from brown (colour 9) to light brown: C64 colour 8 shown with VICE's pepto-pal palette, which tools/run.ps1 selects (assumption A8). Tree trunks stay colour 9.",
"2026-12-03 change (approved): people and status text white (colour 1) instead of light red (A1).",
"2026-12-03 change (approved): worn paths instead of roads: the generator makes no roads; new R7 (walk count per cell, +1 per step into the cell, -1 every 60 s; path at 128, back to terrain below 64; dark brown patch); new milestone M5. The unfinished random-road work (M4.2) was dropped at the user's request."
]
},
"project": {
"name": "Land Map 64",
"slug": "land-map-64",
"idea": "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",
"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.",
"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, 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.",
"kind": "demo",
"smallestUsefulVersion": "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."
"smallestUsefulVersion": "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."
},
"targets": [
{
@@ -30,7 +32,7 @@
"name": "Commodore 64 (NTSC)",
"video": "ntsc",
"id": "c64",
"expectedBehavior": "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.",
"expectedBehavior": "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.",
"platform": "c64"
}
],
@@ -48,7 +50,7 @@
"firstRelease": "A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor-key scrolling, a 5-line status area below the map, 16 moving people blocked by water and stone, double-buffered partial redraw, and SPACE for a new world.",
"inScope": [
"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",
@@ -71,12 +73,12 @@
"requirements": [
{
"title": "Generated 2x2-screen world",
"text": "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).",
"text": "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).",
"priority": "must",
"acceptance": [
"After autostart in VICE (x64sc, NTSC) the map view appears within 15 seconds",
"Scrolling across the whole world shows all five terrain colours: light brown, grey, green, blue and black",
"Roads are continuous black lines that connect to each other; where a road crosses water it is a bridge",
"Scrolling across the whole world shows all four terrain colours: light brown, grey, green and blue",
"The generated world has no roads: only land, grass and trees, stone and water (paths are worn in later, R7)",
"No colour clash: every 4x8 cell shows only its intended colours",
"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",
"Different worlds have different terrain mixes: over several SPACE presses, some worlds are visibly wetter, rockier or greener than others"
@@ -88,7 +90,7 @@
},
{
"title": "16 moving people",
"text": "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.",
"text": "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.",
"priority": "must",
"acceptance": [
"Scrolling around the world shows 16 white dots in total",
@@ -158,11 +160,27 @@
"capabilities": [
"raster-interrupts"
]
},
{
"title": "Worn paths",
"text": "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.",
"priority": "must",
"acceptance": [
"Each time a person steps into a cell, that cell's walk count goes up by one (it stops at 255)",
"Every 60 seconds every walk count goes down by one (it stops at 0)",
"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",
"A path cell whose count falls below 64 turns back into the land, grass or trees it was",
"People walk on paths; water and stone never become paths; SPACE gives a new world with all counts at 0 and no paths"
],
"id": "R7",
"capabilities": [
"smooth-animation"
]
}
],
"design": {
"visuals": {
"value": "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.",
"value": "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.",
"source": "user"
},
"budgets": {
@@ -629,6 +647,74 @@
]
}
]
},
{
"id": "M5",
"title": "Worn paths",
"goal": "People wear paths into the land where they walk often; unused paths fade.",
"tasks": [
{
"id": "M5.1",
"text": "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.",
"requirements": [
"R1"
],
"outcome": "Worlds without roads",
"check": "pwsh -File tools/check-world.ps1 -Runs 10; manual test MT5.1"
},
{
"id": "M5.2",
"text": "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.",
"requirements": [
"R7",
"R2",
"R3",
"R5"
],
"outcome": "Busy cells turn into paths, unused paths fade",
"check": "pwsh -File tools/check-paths.ps1; tools/check-scroll.ps1 -Long; manual test MT5.2"
}
],
"manualTests": [
{
"id": "MT5.1",
"title": "No roads",
"target": "c64",
"setup": "VICE x64sc, NTSC (-ntsc), pepto-pal palette (tools/run.ps1 selects it), warp off.",
"steps": [
"Wait for the map and scroll over the whole world.",
"Tap SPACE a few times and look again."
],
"expected": [
"No black roads or bridges anywhere; land, meadows with trees, rock and lakes as before",
"People walk as before"
],
"requirements": [
"R1"
]
},
{
"id": "MT5.2",
"title": "Worn paths",
"target": "c64",
"setup": "VICE x64sc, NTSC (-ntsc), pepto-pal palette, warp off. The test build (pwsh -File tools/run.ps1 -PathTest) makes paths at 8 steps and fades them below 4 within seconds; the normal build needs minutes of walking.",
"steps": [
"Start the test build and watch the first view for a minute without keys.",
"Scroll around while paths appear and fade.",
"Press SPACE."
],
"expected": [
"Dark brown patches appear where the dots walk most and fade back to the terrain they were (land, grass or trees) when unused",
"Never on water or stone",
"No flicker, tearing, trails or wrong pixels when a cell changes, also while scrolling and where a dot stands on it",
"Dots keep walking over paths",
"SPACE gives a new world with no paths"
],
"requirements": [
"R7"
]
}
]
}
],
"destination": "C:\\Development\\Commodore\\Foundry Projects\\land-map-64",
@@ -716,7 +802,7 @@
"video": "ntsc",
"videoSupport": "ntsc",
"artifact": "build/land-map-64.prg",
"expectedBehavior": "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.",
"expectedBehavior": "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.",
"build": {
"kind": "cc65",
"cc65Target": "c64",


+ 3
- 66
src/world.inc Прегледај датотеку

@@ -18,8 +18,8 @@
; Outside the world counts as water.
; 6. Final tiles: water cells get the shore tile for their open sides, grass
; cells become trees at the world's tree density.
; 7. Two east-west and two north-south roads cross the whole world; over
; water they become bridges.
; No roads are generated (M5.1): paths are worn into the land by the
; people instead (M5.2).
WORLD_WIDTH = 80
WORLD_HEIGHT = 50
SECTOR_WIDTH = WORLD_WIDTH / 2 ; quarters of the world, used to spread people
@@ -78,34 +78,8 @@ generate_world:
jsr smooth_pass
jsr smooth_pass
jsr clean_water
jsr finish_tiles
jmp finish_tiles

; Roads: two east-west and two north-south trunks, as before. They now
; run through terrain and become bridges over water.
jsr random_byte
and #3
clc
adc #10
tax
jsr draw_horizontal_road
jsr random_byte
and #3
clc
adc #WORLD_HEIGHT/2+10
tax
jsr draw_horizontal_road
jsr random_byte
and #7
clc
adc #16
tay
jsr draw_vertical_road
jsr random_byte
and #7
clc
adc #WORLD_WIDTH/2+16
tay
jmp draw_vertical_road

; ---------------------------------------------------------------- 1. mix
; Weights 6-59 per class (sum at most 236, so one random byte can pick), and a
@@ -538,43 +512,6 @@ is_water:
@no: clc
rts

; ---------------------------------------------------------------- 7. roads
draw_horizontal_road:
jsr point_world_row
ldy #WORLD_WIDTH-1
@cell: lda (world_ptr),y
jsr is_water
lda #ROAD_H
bcc @store
lda #BRIDGE_H
@store: sta (world_ptr),y
dey
bpl @cell
rts

draw_vertical_road:
ldx #0
@row: jsr point_world_row
lda (world_ptr),y
cmp #ROAD_H
bne @bridge_h
lda #ROAD_X
bne @store
@bridge_h:
cmp #BRIDGE_H
bne @plain
lda #BRIDGE_X
bne @store
@plain: jsr is_water
lda #ROAD_V
bcc @store
lda #BRIDGE_V
@store: sta (world_ptr),y
inx
cpx #WORLD_HEIGHT
bne @row
rts

; ---------------------------------------------------------------- helpers
; X = world row. Preserves X and Y.
point_world_row:


+ 1
- 1
tools/check-people.ps1 Прегледај датотеку

@@ -202,7 +202,7 @@ function Get-ExpectedBitmap([byte[]]$Clean, [byte[]]$Table) {
$masks = 0xC0, 0x30, 0x0C, 0x03
for ($i = 0; $i -lt $count; $i++) {
$cx = $Table[$i]; $cy = $Table[32 + $i]
if ($cx -ge 39 -or $cy -ge 21) { continue } # 39 drawn columns, 21 buffer rows
if ($cx -ge 39 -or $cy -ge 20) { continue } # 39 drawn columns; the dumps hold the 20 map rows
$offset = $cy * 320 + $cx * 8 + $Table[48 + $i]
$bitmap[$offset] = $bitmap[$offset] -bor $masks[$Table[16 + $i]]
}


+ 5
- 17
tools/check-world.ps1 Прегледај датотеку

@@ -11,8 +11,8 @@
Checks per world:
- 80x50 tile IDs, all known (src/tiles.inc order)
- every terrain type present: land, grass, trees, stone, water (R1.2)
- roads: exactly two full east-west rows and two full north-south columns, crossings
where they meet, no road tile anywhere else; every bridge has water beside it (R1.3)
- no road or bridge tiles: roads are not generated (M5.1); paths are worn in later by
the people (M5.2)
- water: no strip one cell thin, and every water cell has the shore tile its
neighbours call for (outside the world and bridges count as water) (R1.4)
- spread: every 40x20-cell view contains at least three of land, grass and trees,
@@ -68,21 +68,9 @@ function Test-World([byte[]]$tiles, [string]$name) {
if ($p[1] -eq 0) { $fail.Add("no $($p[0]) anywhere") }
}

# Roads.
$hSet = @($ROAD_H, $BRIDGE_H, $ROAD_X, $BRIDGE_X); $vSet = @($ROAD_V, $BRIDGE_V, $ROAD_X, $BRIDGE_X)
$roadRows = @(0..($height - 1) | Where-Object { $y = $_; @(0..($width - 1) | Where-Object { (& $at $_ $y) -notin $hSet }).Count -eq 0 })
$roadCols = @(0..($width - 1) | Where-Object { $x = $_; @(0..($height - 1) | Where-Object { (& $at $x $_) -notin $vSet }).Count -eq 0 })
if ($roadRows.Count -ne 2) { $fail.Add("expected 2 full east-west roads, found $($roadRows.Count)") }
if ($roadCols.Count -ne 2) { $fail.Add("expected 2 full north-south roads, found $($roadCols.Count)") }
for ($y = 0; $y -lt $height; $y++) {
for ($x = 0; $x -lt $width; $x++) {
$t = & $at $x $y
$onH = $y -in $roadRows; $onV = $x -in $roadCols
$isRoad = $t -ge $ROAD_H
if ($onH -and $onV) { if ($t -notin @($ROAD_X, $BRIDGE_X)) { $fail.Add("crossing at ($x,$y) is tile $t") } }
elseif (-not ($onH -or $onV) -and $isRoad) { $fail.Add("road tile $t off the road grid at ($x,$y)") }
}
}
# No roads or bridges at generation time.
$roadCells = 0; for ($t = $ROAD_H; $t -lt $TILE_COUNT; $t++) { $roadCells += $counts[$t] }
if ($roadCells -gt 0) { $fail.Add("$roadCells road or bridge cells: the generator must not make roads") }

# Water: neighbours count as water if water family, bridge, or outside the world.
$isWet = { param($x, $y)


Loading…
Откажи
Сачувај

Powered by TurnKey Linux.