1985 · Melbourne House

Way of the Exploding Fist

This minisite was contributed by air, chunkypixel. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/way-of-the-exploding-fist with me to Gold.

The fighters built from nine sprites, the stick and the keyboard, a hit test that measures distance, an opponent tuned by eight tables, and seven raster interrupts a frame.

01 · The fighters

Every pose is built from nine pieces

A fighter is a three-by-three grid of multicolour sprites. The game never stores a whole pose. Each shape frame is nine cell numbers, and each cell is a 64-byte piece of a karateka.

Stick

Press a direction, with or without fire, to play that move's animation as the game stores it: a list of steps, each a number of ticks, a shape frame and a step in X and Y ($7720). The pose is assembled the way the sprite builder ($3914) does it, from the frame tables at $7AE0 and the cells at $8000; facing left takes the columns in reverse and mirrors every byte through the table at $7E00 ($3BC5). Checked against both fighters' sprites in a snapshot of play.

Sixteen stick positions give sixteen moves, in the table at $286C. Down-forward from standing is a punch (move $18), and from a crouch a different blow (move 7); fire with back from standing becomes a turn round ($12). There are 79 shape frames. The karateka use $00-$3A, and $3B-$4C are the bull of the bonus round, which uses the same tables but takes each byte as a sprite pointer instead of a cell ($5D = $40).

Each fighter has two 576-byte buffers at $C040-$C93F and is rebuilt into the spare one whenever its frame changes, so a half-built pose is never on screen. A cell of 0 leaves its sprite blank: the standing pose fills six of the nine.

02 · Controls

Two joysticks, or two halves of the keyboard

The white fighter reads joystick port 2 and the red fighter port 1 ($2851). F7 in the attract mode swaps both to the keyboard, with a block of nine keys for each player.

DirectionsFireRead at
Player 1 (white)Q W E · A D · Z X CS or left SHIFT$28B2
Player 2 (red)P @ * · L ; · , . /: or right SHIFT$2931

Each block is the stick's eight directions around its fire key, S or :, and the first direction held wins. The function keys work only between games ($1E64): F1 or fire starts one, F3 switches between one and two players, F7 between joystick and keyboard, DEL switches the shouts off, and F5 abandons a game at any time.

Pulling back while the opponent's blow is in reach turns into the block that stops it ($2AF2), so a player defends by retreating.

03 · Scoring

A blow scores by distance, not timing

The manual talks of well-executed and loosely timed blows. In the code a blow is tested once, on its striking frame, and the only question is how far apart the fighters stand.

A port of the hit test ($2B8E) for fighters facing each other, checked against the game's own routine for every blow, every defender frame and every distance from -40 to 60: 65,549 cases, no difference. Green is a whole point, amber a half, grey a miss; the distance is the attacker's along its facing.

Each blow has a reach profile, one byte per frame the defender might be in ($7200-$7711, 22 profiles). The byte is the distance at which the blow lands squarely. At that distance, or closer by up to a margin the blow sets ($11BD), it is a whole point; closer still, by up to a second margin ($11D6), a half point. A profile byte of $80 means a defender in that frame cannot be hit, which is how jumps and somersaults evade.

Four half points win a bout. Points for the score come from a table in hundreds ($12A5), halved for a half point.

04 · The opponent

Ten dans of the same opponent, with faster reflexes

The computer fights every bout with the same rules. What changes with rank is a set of eight masks that limit how long it waits, walks, holds a move and reacts.

The per-level tables at $27A9-$27FC, as ai_level_setup ($2593) loads them. Each is a mask the computer applies to a random number: for the timers (hold, wait, walk, pause, reaction) a smaller mask means shorter waits; the others narrow its choices. Level 0 is Novice; the level rises by one with each bout won.

When attacked, the computer either blocks with the right block for the blow ($118F), starts one of nine scripted plans ($2774), or counter-attacks. When close it picks an attack from a table indexed by distance ($26D5), and against a blocking player it chooses among the blows that block does not stop ($27A1). The reaction-delay mask is zero from level 4 up, so from 4th dan the computer reacts at once. The walking table has 11 entries for 12 levels, so level 11 reads the first byte of the next table.

In a one-player game, two bout wins clear a rank, from Novice to 10th dan ($1BA7); a lost bout ends the game. Past 10th dan the rank stays on screen as 10TH DAN while the opponent's level is drawn at random from 7 to 10 ($1C65).

05 · The screen

Seven raster interrupts draw one frame

Two fighters need eighteen sprites and the machine has eight. The game draws the top row of both fighters with sprites 0-5, then moves those sprites down the screen as the beam passes.

One frame of a two-player bout, drawn from memory and the recorded writes to the video chip with the site's renderer: all 104,448 pixels match the emulator's own picture of the same frame. The chain: $31F2 at line 0 sets up the frame, $2FB0 switches to the bitmap at line 90, the sprite handlers move sprites 0-5 down a row of 21 lines at a time, a handler on line 217 draws the shadow, and $30E5 at line 255 returns to text for the panel and plays the music.

The gap between the two fighters' heights decides which of seven interrupt chains runs that frame ($32CD). When one fighter is exactly 20 lines higher than the other, one fighter's second row and the other's third start a line apart, and a combined handler moves all six sprites at once ($2F02, $2F59). The routines that set this up ($3291-$3750) work by rewriting the handlers' own instructions: the raster line, the sprite heights and the pointers are all operands patched every frame.

A jumping fighter casts a shadow on the floor. It is a fourth row of sprites from a fixed set under the I/O chips ($D480), shown at a fixed height while the fighter is off the ground.