You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 line
20KB

  1. {
  2. "schemaVersion": "1.0",
  3. "status": "approved",
  4. "approval": { "approvedBy": "example user (Foundry demo)", "approvedOn": "2026-11-26", "notes": "Demo brief produced with the normal interview workflow; the defaults below were accepted as proposed." },
  5. "interview": {
  6. "startedOn": "2026-11-26",
  7. "stage": "review",
  8. "openQuestions": [],
  9. "notes": [
  10. "User idea was short; the Foundry proposed the smallest playable loop (one intersection, fixed spawn pattern, three crashes ends the shift) and the user accepted it.",
  11. "User asked for fully manual signals: no automatic timers and no interlock that prevents conflicting greens. Unsafe choices must be possible and must have visible consequences."
  12. ]
  13. },
  14. "project": {
  15. "name": "Traffic Control 64",
  16. "slug": "traffic-control-64",
  17. "idea": "An original hybrid arcade and simulation game for the C64. You run one intersection at a time, with cars and pedestrians, and you control the signals completely by hand. Unsafe choices can cause collisions.",
  18. "summary": "A top-down, single-screen traffic game for the Commodore 64. Cars arrive from four directions and pedestrians wait at the crosswalks. The player switches the north-south and east-west signals and the pedestrian WALK signal by hand. Good timing clears traffic and earns points. Conflicting signals let vehicles or pedestrians collide, which ends the shift after three crashes.",
  19. "kind": "game",
  20. "smallestUsefulVersion": "One intersection on one screen. Cars enter from all four sides and pedestrians from the corners. Three player-controlled signals: N-S, E-W and WALK. Cars stop on red and go on green. Collisions are detected and shown. A CLEARED counter and a CRASHES counter. The shift ends at 3 crashes, and a key restarts."
  21. },
  22. "destination": "../Foundry Projects/traffic-control-64",
  23. "targets": [
  24. {
  25. "id": "c64",
  26. "name": "Commodore 64 (PAL primary, NTSC supported)",
  27. "platform": "c64",
  28. "display": "vicii-40",
  29. "video": "pal-ntsc",
  30. "expectedBehavior": "Autostarts to the intersection screen: title on row 0, score line on row 1, green grass with a grey crossroads, white crosswalk stripes, two signal heads, phase line 'N-S: GREEN E-W: RED WALK: OFF' on row 23. A frame counter on row 1 advances once per video frame."
  31. }
  32. ],
  33. "dualTarget": null,
  34. "buildLocation": "windows-cross",
  35. "onCommodore": null,
  36. "testing": {
  37. "emulator": "vice",
  38. "realHardware": { "requested": false, "reason": "" }
  39. },
  40. "scope": {
  41. "firstRelease": "A playable single-intersection shift with manual signals, moving cars and pedestrians, and visible safe and unsafe outcomes. Scoring, game over and restart are included.",
  42. "inScope": [
  43. "One four-way intersection on a single 40x25 text screen",
  44. "Cars from four approaches (one lane each way), pedestrians on four crosswalks",
  45. "Manual control of the N-S signal, the E-W signal and the pedestrian WALK signal",
  46. "Collision detection between cars on crossing paths and between cars and pedestrians in a crosswalk",
  47. "CLEARED and CRASHES counters, game over at 3 crashes, restart",
  48. "Simple SID sound effects for signal change, crash and car cleared",
  49. "PAL and NTSC timing that is identical in game seconds"
  50. ],
  51. "outOfScope": [
  52. "Multiple intersections or scrolling maps",
  53. "Turning traffic, emergency vehicles, buses",
  54. "Automatic or timed signal programs",
  55. "High-score saving to disk",
  56. "Music",
  57. "C128 native mode (it runs on a C128 only in C64 mode, untested)"
  58. ]
  59. },
  60. "requirements": [
  61. {
  62. "id": "R1",
  63. "title": "Intersection display",
  64. "priority": "must",
  65. "text": "The playfield shows one intersection: grass, a N-S road (columns 16-23) and an E-W road (rows 8-15), crosswalk stripes on all four approaches, and two signal heads.",
  66. "acceptance": [
  67. "After autostart the intersection screen appears within 5 seconds in VICE (x64sc, PAL)",
  68. "Row 0 reads 'TRAFFIC CONTROL 64'",
  69. "Rows 2-21 show green grass, a grey cross of roads and white crosswalk stripes"
  70. ],
  71. "capabilities": ["text-ui"]
  72. },
  73. {
  74. "id": "R2",
  75. "title": "Visible signal phases",
  76. "priority": "must",
  77. "text": "Each signal has phases RED, YELLOW and GREEN (WALK is ON or OFF). The current phases are always shown as text on row 23 and as lit lamps on the signal heads. Neither display depends on colour alone.",
  78. "acceptance": [
  79. "Row 23 shows 'N-S: <phase>', 'E-W: <phase>' and 'WALK: <ON|OFF>' matching the current state",
  80. "The lit lamp on each signal head matches the text phase (top/left red, middle yellow, bottom/right green)",
  81. "A phase change is visible within one frame of the key press"
  82. ],
  83. "capabilities": ["text-ui"]
  84. },
  85. {
  86. "id": "R3",
  87. "title": "Fully manual signal control",
  88. "priority": "must",
  89. "text": "Keyboard: N cycles the N-S signal RED->GREEN->YELLOW->RED, E cycles the E-W signal the same way, W toggles WALK. Joystick in port 2: up/down cycles N-S, left/right cycles E-W, fire toggles WALK. There are no automatic timers or interlocks: the player can set conflicting phases.",
  90. "acceptance": [
  91. "Pressing N three times from RED goes GREEN, YELLOW, RED",
  92. "Setting N-S GREEN and E-W GREEN at the same time is possible and is shown",
  93. "Joystick port 2 performs the same actions as the keys"
  94. ],
  95. "capabilities": ["keyboard-input", "joystick-input"]
  96. },
  97. {
  98. "id": "R4",
  99. "title": "Traffic and pedestrian movement",
  100. "priority": "must",
  101. "text": "Cars spawn at the screen edges on all four approaches and move one character cell at a time toward the far side. A car stops at its stop line on RED. It also stops on YELLOW if it has not reached the stop line. It proceeds on GREEN. Pedestrians wait at the corners and cross only when WALK is ON. Movement is frame-locked: cars advance every 8 frames on PAL and every 10 on NTSC, which is 6.25 cells per second on both. Pedestrians move at half that speed.",
  102. "acceptance": [
  103. "With N-S GREEN, N-S cars pass through the intersection and leave the screen; E-W cars queue at their stop lines on RED",
  104. "A car takes the same time (within 5%) to cross the screen on PAL and NTSC",
  105. "Pedestrians stay on the corner while WALK is OFF and cross while it is ON"
  106. ],
  107. "capabilities": ["smooth-animation"]
  108. },
  109. {
  110. "id": "R5",
  111. "title": "Safe and unsafe outcomes",
  112. "priority": "must",
  113. "text": "A car that leaves the screen adds 1 to CLEARED. A pedestrian who reaches the far corner adds 1 to CLEARED. A collision happens when two cars on crossing approaches occupy the same cell, or when a car enters a crosswalk cell that holds a pedestrian. It flashes the involved cells, plays the crash sound, adds 1 to CRASHES and removes the involved movers.",
  114. "acceptance": [
  115. "Safe play (only one direction green at a time, WALK only while both roads are red) for 60 seconds produces CLEARED > 0 and CRASHES 0",
  116. "Setting both roads GREEN with traffic present produces a visible crash and CRASHES increments within 10 seconds",
  117. "WALK ON while the crossing road is GREEN with traffic produces a pedestrian collision"
  118. ],
  119. "capabilities": ["text-ui"]
  120. },
  121. {
  122. "id": "R6",
  123. "title": "Game over and restart",
  124. "priority": "must",
  125. "text": "At 3 crashes the shift ends. Movement stops and 'SHIFT OVER - CLEARED nnn' is shown with 'PRESS FIRE OR SPACE'. Fire or SPACE starts a new shift with counters reset.",
  126. "acceptance": [
  127. "The third crash shows the game-over message and freezes movement",
  128. "SPACE or fire restarts with CLEARED 000 and CRASHES 0/3"
  129. ],
  130. "capabilities": ["keyboard-input", "joystick-input"]
  131. },
  132. {
  133. "id": "R7",
  134. "title": "Sound effects",
  135. "priority": "should",
  136. "text": "SID voice 1: a short click on each signal change. Voice 2: a noise burst on a crash. Voice 3: a short rising tone when a car or pedestrian is cleared.",
  137. "acceptance": [
  138. "Each of the three events produces its distinct sound in VICE with sound enabled"
  139. ],
  140. "capabilities": ["sid-sound"]
  141. }
  142. ],
  143. "design": {
  144. "controls": { "value": "Keyboard N / E / W for N-S, E-W and WALK; joystick port 2 up/down = N-S, left/right = E-W, fire = WALK; SPACE or fire restarts after game over.", "source": "default" },
  145. "visuals": { "value": "Character-mode playfield using reverse-space blocks for grass (green), road (dark grey) and crosswalks (white). Cars are coloured solid PETSCII blocks with one colour per approach. Pedestrians are a light-colour figure character. No sprites in the first release, so collision cells are exact character cells.", "source": "default" },
  146. "sound": { "value": "Three SID effects (signal click, crash noise, cleared tone); no music.", "source": "default" },
  147. "persistence": { "value": "None. Scores are not saved.", "source": "n/a" },
  148. "fileFormats": { "value": "None. A single PRG.", "source": "n/a" },
  149. "peripherals": { "value": "Joystick in control port 2 (optional; keyboard works alone). No disk access after loading.", "source": "default" },
  150. "budgets": { "value": "Logic, drawing and input in under 50% of a frame (about 9,800 of 19,656 PAL cycles), so all updates fit in one frame. At most 16 cars and 8 pedestrians active. Program under 16 KB. PAL 50 Hz primary; NTSC 60 Hz uses scaled movement intervals so game speed matches.", "source": "default" },
  151. "other": [
  152. { "topic": "Difficulty", "value": "Spawn interval starts at 3 seconds per approach and shortens by 10% every 30 cleared movers (minimum 1 second).", "source": "default" }
  153. ]
  154. },
  155. "capabilities": ["text-ui", "keyboard-input", "joystick-input", "smooth-animation", "sid-sound"],
  156. "assumptions": [
  157. { "id": "A1", "text": "Character-cell movement at 6.25 cells per second reads as smooth enough for this game. Sprite movement is not needed in the first release.", "status": "default" },
  158. { "id": "A2", "text": "Video standard is detected at start with get_tv(), which reads the KERNAL PAL/NTSC flag. Movement intervals are 8 frames on PAL and 10 on NTSC.", "status": "default" },
  159. { "id": "A3", "text": "The frame loop is synchronised to raster line 251 (wait_frame in frame.s). This line exists on PAL and NTSC.", "status": "unverified" },
  160. { "id": "A4", "text": "VICE x64sc with default C64 model settings is a faithful reference for timing.", "status": "default" }
  161. ],
  162. "openDecisions": [
  163. { "id": "D1", "topic": "difficulty", "question": "Should difficulty ramp by time or by cleared count?", "default": "By cleared count (every 30 cleared movers).", "status": "open" }
  164. ],
  165. "toolchain": {
  166. "recipe": "cc65",
  167. "language": "mixed-c-asm",
  168. "recommended": { "recipe": "cc65", "language": "mixed-c-asm" },
  169. "reasons": [
  170. "BASIC V2 is too slow: updating up to 24 movers, checking collisions and polling input every frame is far beyond what interpreted BASIC can do in 20 ms.",
  171. "C (cc65) is fast enough for character-cell game logic at this scale and keeps the game rules readable and easy to change.",
  172. "A small ca65 module provides the raster-synchronised frame wait (and later the SID effect driver), which are the timing-sensitive parts. The rest stays in C.",
  173. "Everything builds on Windows with one cc65 install and runs in VICE x64sc."
  174. ],
  175. "alternatives": [
  176. { "option": "BASIC V2", "whyNot": "Too slow for frame-locked movement of many objects with collision checks." },
  177. { "option": "C only (cc65)", "whyNot": "Workable, but a busy-wait on the raster in C is fragile and the SID driver is easier in assembly. Mixed keeps those parts small and exact." },
  178. { "option": "6502 assembly only (ca65)", "whyNot": "Fastest, but the game rules (phases, queues, collisions, scoring) would take much longer to write and review. The speed is not needed." }
  179. ],
  180. "override": null,
  181. "assumptionsToVerify": [
  182. "A3: wait_frame() keeps one update per frame on both PAL and NTSC (check the frame counter rate in VICE with -pal and -ntsc).",
  183. "Frame budget: measure the worst-case update time (16 cars, 8 pedestrians) with a border-colour timing bar before M3 is complete."
  184. ]
  185. },
  186. "starter": {
  187. "screenTitle": "TRAFFIC CONTROL 64",
  188. "expectedScreen": "The intersection screen. Row 0: 'TRAFFIC CONTROL 64'. Row 1: 'CLEARED 000 CRASHES 0/3 PAL' and a frame counter 'Fnnn' that keeps changing. Rows 2-21: green grass, grey crossroads, white crosswalk stripes. North-east signal head with the bottom (green) lamp lit, south-west head with the left (red) lamp lit. Row 23: 'N-S: GREEN E-W: RED WALK: OFF'. Row 24: 'STARTER: SIGNALS FIXED. ANY KEY EXITS'.",
  189. "smokeChecks": [
  190. { "row": 0, "col": 0, "text": "TRAFFIC CONTROL 64", "description": "Title on row 0" },
  191. { "row": 1, "col": 0, "text": "CLEARED 000 CRASHES 0/3", "description": "Score line on row 1" },
  192. { "row": 23, "col": 0, "text": "N-S: GREEN", "description": "N-S phase shown on row 23" },
  193. { "row": 23, "col": 13, "text": "E-W: RED", "description": "E-W phase shown on row 23" },
  194. { "row": 23, "col": 26, "text": "WALK: OFF", "description": "WALK state shown on row 23" }
  195. ],
  196. "filesDir": "files",
  197. "requirements": ["R1"]
  198. },
  199. "milestones": [
  200. {
  201. "id": "M1",
  202. "title": "Manual signals",
  203. "goal": "The player controls all three signals and sees every phase change immediately.",
  204. "tasks": [
  205. { "id": "M1.1", "text": "Keyboard input: N, E and W change the signal state as specified in R3. Redraw the phase line and the signal heads on change.", "requirements": ["R2", "R3"], "outcome": "PRG in which N/E/W change row 23 and the lamps", "check": "Manual test MT1.1; smoke test still passes with the initial phases" },
  206. { "id": "M1.2", "text": "Joystick port 2 mapping (edge-triggered so that holding the stick changes the phase only once).", "requirements": ["R3"], "outcome": "PRG controllable by joystick", "check": "Manual test MT1.2" },
  207. { "id": "M1.3", "text": "Signal-change click on SID voice 1 (assembly sound module).", "requirements": ["R7"], "outcome": "PRG with an audible click on each change", "check": "Manual test MT1.1 step 4" }
  208. ],
  209. "manualTests": [
  210. { "id": "MT1.1", "title": "Cycle signals by keyboard", "target": "c64", "setup": "VICE x64sc, PAL, sound on.", "steps": ["Wait for the intersection screen.", "Press N three times, watching row 23 and the north-east signal head.", "Press E once, then W once.", "Listen for a click on each key press."], "expected": ["After N: N-S shows YELLOW, then RED, then GREEN (it started GREEN), and the lit lamp moves to match each time", "After E: 'E-W: GREEN'. Both roads now show GREEN; this is allowed", "After W: 'WALK: ON'", "One click per change"], "requirements": ["R2", "R3", "R7"] },
  211. { "id": "MT1.2", "title": "Cycle signals by joystick", "target": "c64", "setup": "VICE: a joystick or keyset mapped to port 2.", "steps": ["Push up once and release.", "Push left once and release.", "Press fire once."], "expected": ["Each action changes exactly one signal by one step, exactly as the keys do"], "requirements": ["R3"] }
  212. ]
  213. },
  214. {
  215. "id": "M2",
  216. "title": "First playable loop",
  217. "goal": "Cars and pedestrians move, obey the signals, and produce observable safe and unsafe outcomes.",
  218. "tasks": [
  219. { "id": "M2.1", "text": "Car movers: spawn on each approach, frame-locked movement with PAL/NTSC intervals, stop-line behaviour on RED/YELLOW, queueing behind stopped cars.", "requirements": ["R4"], "outcome": "PRG with cars that obey the N-S/E-W signals", "check": "Manual test MT2.1" },
  220. { "id": "M2.2", "text": "Pedestrian movers: wait at corners, cross on WALK, add to CLEARED on arrival.", "requirements": ["R4", "R5"], "outcome": "PRG with pedestrians that obey WALK", "check": "Manual test MT2.2" },
  221. { "id": "M2.3", "text": "Collision detection and crash feedback (flash, noise, CRASHES +1, remove movers). Cleared counting for cars.", "requirements": ["R5", "R7"], "outcome": "PRG where unsafe phases cause visible crashes", "check": "Manual tests MT2.3 and MT2.4" },
  222. { "id": "M2.4", "text": "Game over at 3 crashes, and restart.", "requirements": ["R6"], "outcome": "PRG with a complete shift loop", "check": "Manual test MT2.5" }
  223. ],
  224. "manualTests": [
  225. { "id": "MT2.1", "title": "Cars obey signals", "target": "c64", "setup": "Fresh start (N-S GREEN, E-W RED).", "steps": ["Watch for 15 seconds without pressing keys."], "expected": ["N-S cars drive through and leave the screen; CLEARED increases", "E-W cars stop at the stop line just before the crosswalk and queue"], "requirements": ["R4"] },
  226. { "id": "MT2.2", "title": "Pedestrians obey WALK", "target": "c64", "setup": "Fresh start.", "steps": ["Press N until N-S is RED (E-W is already RED).", "Press W (WALK ON) and watch for 10 seconds."], "expected": ["Pedestrians do not leave the corners before WALK is ON", "With WALK ON they cross, and CLEARED increases as each one arrives", "No crash occurs"], "requirements": ["R4", "R5"] },
  227. { "id": "MT2.3", "title": "Unsafe: both roads green", "target": "c64", "setup": "Fresh start.", "steps": ["Press E once so E-W is GREEN while N-S is still GREEN.", "Wait up to 10 seconds."], "expected": ["Cars from crossing directions meet in the intersection", "The crash cells flash, a noise burst plays, and CRASHES shows 1/3"], "requirements": ["R5"] },
  228. { "id": "MT2.4", "title": "Safe play for one minute", "target": "c64", "setup": "Fresh start; a stopwatch.", "steps": ["For 60 seconds, alternate: N-S GREEN with E-W RED, then N-S RED (via YELLOW) and E-W GREEN, about every 8 seconds; only use WALK while both are RED."], "expected": ["CLEARED is greater than 0", "CRASHES stays 0/3"], "requirements": ["R5"] },
  229. { "id": "MT2.5", "title": "Game over and restart", "target": "c64", "setup": "Fresh start.", "steps": ["Cause three crashes as in MT2.3.", "Press SPACE."], "expected": ["After the third crash: 'SHIFT OVER - CLEARED nnn' and 'PRESS FIRE OR SPACE', with movement frozen", "After SPACE: CLEARED 000 and CRASHES 0/3, and traffic starts again"], "requirements": ["R6"] },
  230. { "id": "MT2.6", "title": "PAL/NTSC speed match", "target": "c64", "setup": "pwsh -File tools/run.ps1 -Target c64 -Video ntsc, then the same with -Video pal.", "steps": ["Time one N-S car from entering at the top edge to leaving at the bottom, on each standard."], "expected": ["Row 1 shows NTSC or PAL to match", "The two times differ by no more than 5%"], "requirements": ["R4"] }
  231. ]
  232. },
  233. {
  234. "id": "M3",
  235. "title": "Polish within budget",
  236. "goal": "Remaining sound effects and difficulty ramp, with the frame budget confirmed.",
  237. "tasks": [
  238. { "id": "M3.1", "text": "Cleared tone (voice 3), and the difficulty ramp as decided in D1.", "requirements": ["R7", "R4"], "outcome": "PRG with all three effects and the spawn ramp", "check": "Manual test MT3.1" },
  239. { "id": "M3.2", "text": "Worst-case frame-budget check with a border-colour timing bar behind a debug key. Document the result in docs/toolchain.md.", "requirements": ["R4"], "outcome": "Measured worst-case frame time recorded", "check": "Manual test MT3.2" }
  240. ],
  241. "manualTests": [
  242. { "id": "MT3.1", "title": "Sounds and ramp", "target": "c64", "setup": "Sound on.", "steps": ["Play safely for 2 minutes."], "expected": ["Distinct sounds for signal change, crash and cleared", "Cars arrive noticeably more often after about 30 cleared movers"], "requirements": ["R7", "R4"] },
  243. { "id": "MT3.2", "title": "Frame budget", "target": "c64", "setup": "Debug timing bar enabled (key documented by the agent).", "steps": ["Let traffic build to the maximum (both roads RED for 20 seconds)."], "expected": ["The border timing bar never reaches the bottom of the screen area, so every update fits in one frame"], "requirements": ["R4"] }
  244. ]
  245. }
  246. ]
  247. }

Powered by TurnKey Linux.