Created
July 18, 2026 05:39
-
-
Save jaymcgavren/4e1d369c3341c0449ddb21beb5e4effe to your computer and use it in GitHub Desktop.
Describing Zanac (NES) map "scripting" using Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ❯ You seem to have discovered a lot about the map "scripting" in Zanac. E.g. @tools/decode_mapscript.py . Can you summarize what the | |
| script for the first area does for me? | |
| ⏺ Here's the area‑1 script (bank5 $A411, decoded with tools/decode_mapscript.py; commands documented at src/bank7.asm:4617 | |
| MapScriptExecCmd). | |
| How to read it | |
| The script is paced by map distance $A2/$A3 — one unit per generated map row, not per frame. At the default 2.0 px/frame scroll, ~4 | |
| frames per row. Each command fires when distance reaches its trigger, so everything below is at a fixed position in the level, never | |
| on a timer or a proximity test. | |
| Area 1 timeline | |
| Distance 0 — setup burst (five commands at once) | |
| - cmd1 base map pattern $A8=$09 (the terrain the row generator repeats) | |
| - cmd2 spawn scripts: supplemental $B0=$A655, timed enemy spawner $6C=$A668 | |
| - two cmd4 palette loads ($A3F7 flags 1, $A2C2 flags 2 — map + object palettes) | |
| - cmd6 opens 5 feature channels: ch0–ch3 all pointed at header $A26F at columns 0/4/8/12 (the four-lane border/wall structure), plus | |
| ch4 as an inline blob (229 rows × 144) | |
| Distance 8 → 375 — the opening stretch. A steady stream of cmd6 calls retargeting feature channels 4–7 as terrain/formation | |
| emitters: each entry is column, delay before first emit, reload interval, repeat count, and either a header pointer in bank5 or an | |
| inline rows/width/data blob. Landmarks: a heavy 3-entry set at 200, a wide inline feature at 268, a re-arm of the ch4 base blob at | |
| 280, and at 300 a four-entry set that's the only one using drift (flags=$96/$85, drift=255 — a per-row column walk, so a | |
| diagonal/curving structure). At 375 a cmd4 swaps to palette $A404 — the pre-boss color change. | |
| Distance 400 — MID-BOSS #1. cmd7 BOSS DECEL flag=20, countdown=8, $C8/$C7=2/2. This loads the deceleration controller and sets | |
| $C0=$01, ramping scroll 2.0 → 1.5 → 1.0 → 0.75 → 0.5 → 0.25 → locked. It also brings in one feature on ch7 at column 7 ($9FCC = the | |
| boss structure). At 425 cmd4 restores palette $A3F7 — i.e. the fight is expected over by then and the script just keeps rolling | |
| regardless. | |
| Distance 500 → 606 — second stretch. Reopens ch1/ch2 wall lanes at 528 (this time with delay=0 reload=4, so they repeat rather than | |
| sit static), and a 3-entry set at 606. | |
| Distance 625 — MID-BOSS #2. Palette $A404 again on the same distance, then cmd7 flag=40, countdown=8, $C8/$C7=2/3, boss feature | |
| $A357 at column 6. Palette restored at 645. | |
| Distance 679 → 1450 — the long run to the end. ~14 more cmd6 sets. Notables: at 718 the biggest one (7 entries) resets the | |
| ch1/ch2/ch3 lane structure to header $A281 and parks ch0 at column 128 with a null header (a channel disable idiom); at 1099 a | |
| 6-entry set that's the second drift user (ch0 col=254 → i.e. −2, and ch5 drift=1) plus a long repeats=1, delay=27 ch7 emitter. | |
| Distance 1504 — END BOSS. cmd7 flag=40 but a much longer countdown=10, $C7=36, $C3=3 — a slower, deeper lock than the mid-bosses — | |
| with two features: $A0FA at column 4 and $A11C at column 5, the two halves of the fortress. | |
| Distance 1505 — cmd5 AREA ADVANCE. This is the detail worth flagging: the area-transition request is armed one map step into the | |
| boss approach, not after the boss dies. It sets the pending-advance bits and then just sits there while the fight happens — the | |
| transition only actually executes once the boss-active phase bits clear (AreaTransition $E8C9). The script has no commands after | |
| this; $A656 runs straight into the supplemental spawn script data at $A655, so the decoder's output past that line is garbage. | |
| Shape overall: three set-pieces (400, 625, 1504) partitioning a ~1500-row area into three terrain stretches, with palette swaps | |
| bracketing the first two fights and a single unconditional advance armed at the end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment