Melee Lab: reading a GameCube fighter from the source up
On this page
Most of what people know about Super Smash Bros. Melee is folklore passed down through twenty years of frame-data spreadsheets and tournament commentary. Some of it is dead-on. Some of it is half-right. And because the doldecomp/melee project has decompiled so much of the US 1.02 C source, you do not have to guess anymore — you can just read the code.
Melee Lab is the learning workbench I built alongside an unmodified upstream snapshot (ae5898ee). It started as a way to trace one familiar move from button press to hitbox, and turned into 27 lessons, a local browser dashboard, a playable original platform fighter built on the traced rules, and a Docker harness that compiles single files with the original GameCube compiler so you can read the PowerPC assembly diff.
Label what you actually proved
The easiest trap in a reverse-engineering project is mixing what the code actually says with what you remember from playing the game — or what an LLM confidently summarizes for you. Early sessions caught several claims that sounded plausible and turned out to be wrong when checked against the C source.
So every lesson in Melee Lab labels its claims explicitly: verified, inferred, not traced, or community-reported. Source references anchor to symbols rather than raw line numbers, because line numbers shift whenever upstream updates. A content check runs as part of the test suite and validates 26 structured lessons and 135 source anchors so broken references fail loudly.
The same honesty applies to numbers. The C source contains struct offsets such as p_ftCommonData->x…, while the actual numeric tuning constants live in the game's binary data files. Because Melee Lab never uses a game image or main.dol, every numeric constant in the simulator and arena stays explicitly illustrative rather than pretending to be exact Melee frame data.
Start with one move, then follow the frame loop
Understanding one complete move teaches more than memorizing a directory tree. The lessons start with Mario's fireball — tracing input, state transitions, move-script command events, and the handoff across the fighter-to-item boundary — and then work outward through the whole system:
- Movement and stage geometry: short-hop selection and union storage, air-dodge velocity decay and wavedash friction, ledge-snap geometry and regrab cooldowns, and why the swept floor test makes platforms one-way until a one-line drop-through skip runs.
- Combat and defense: capsule hitbox collisions, the knockback formula, hitlag callbacks, perpendicular DI and fresh-flick SDI, the L/R tech window and anti-mash lockout, crouch cancel modifiers, the 10-slot move-staling ring, shields, grabs, and why throws ignore victim weight in knockback.
- Shared code, separate data: how characters like Fox and Falco (or Mario and Dr. Mario) run the same reflector function fed by different
ReflectDescstructs, and how the animation pass updatesHSD_JObjbone trees lazily before move scripts query hitbox positions. - The match around the fight: CPU brain ticks feeding the same virtual controller struct a human uses, hit feedback consuming RNG, and Sudden Death's Bob-omb rain schedule.
The Practice Arena
Reading C is one way to check your understanding. Re-implementing the rule in your own engine is a much harsher test.
Inside the local dashboard, game-engine.js is an original platform fighter built from scratch on the traced rules: short hops, wavedashes, ledges, drop-through platforms, percent-scaled knockback, DI and SDI, teching, shields and grabs, throws, crouch cancel, staling, same-frame trades and clanks, L-cancelling, projectiles, reflectors and absorbers, three characters that share code but not data, five stages, stock and time matches, Sudden Death Bob-omb rain, two-player versus, a CPU opponent, and deterministic replays.
No Nintendo code or data is used anywhere in it. At archive time, the test suite runs 16 Python tests, the content-anchor check, and 120 JavaScript tests — 106 of them exercising the game engine directly — and lets you pause the arena and step one frame at a time to inspect what just happened.
Reading the PowerPC without a console
The final question was how a C change actually lands in machine code. Mod Lab wraps the original GameCube compiler inside Docker (./mod-lab/try.sh) so you can modify a single file — like doubling a fireball's speed — compile just that translation unit, and inspect the exact PowerPC disassembly diff.
Lesson 25 uses real Mod Lab disassembly from five traced functions to walk through calling conventions, leaf versus non-leaf stack frames, struct offsets, float comparisons, and bitfield inserts. You can verify a decompilation claim against the generated instructions without ever needing a console or a full ROM build.
Where it stops
Melee Lab is a local prototype and reading guide, not an emulator and not a playable Melee build. Full game compilation and Dolphin execution remain intentionally closed off because they require the game's original binary. Everything that can be learned honestly from the source — how a 25-year-old action game organizes its frame loop, state machines, collisions, and data sharing — is already sitting in plain sight.
