1987 · Firebird

Bubble Bobble

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

The eight kinds of enemy, drawn from the game's own sprites, and the routine each one runs, which you can step a frame at a time.

01 · The cast

The eight kinds of enemy

Each round's list gives every enemy a kind from 0 to 7, and the kind picks a picture and a routine.

Sprites drawn from the game's own data at $5CC0-$703F, in the colours of the table at $AB63. "First round" and "in all" are counted from the 100 enemy lists at $AE51, which hold 572 enemies.

An enemy record is three bytes: its kind and column, its row and heading, and how long it waits before it moves. The six sprites not used by the players limit a round to six enemies.

The walkers share one routine ($EA08). An enemy on the same level as its player just walks. One below its player keeps a timer, and each time the timer runs out the enemy changes its mind about whether to climb; while it wants to, it jumps for any platform it finds overhead. Three of the walkers also shoot along their row when they face a player who is level with them ($EDCD).

Enemies and players never use the video chip's collision registers. Every test is a comparison of coordinates: a player dies within 12 pixels of an enemy ($1D32), and a bubble catches an enemy within 16 ($105B).

02 · Enemy movement

How an enemy decides, frame by frame

Each enemy's routine runs on every other frame. Below, the ported game runs one round at a time; step it and read what each enemy's routine did and why.

What each enemy did

The game's own code, ported (the Play tab says how it was checked), with the enemy routines wrapped to say when they run. Go builds the round as the game does; the step buttons move the game's clock. A line names the enemy's state, its position and heading, then the routines that ran in the actor interrupt and what they changed.

A walker ($EA08) falls when nothing is under it; on a floor it follows its heading bits, and turns at a wall. Whether it may climb is decided by its chase routine ($EE62). Level with its player it walks. Higher than its player it never climbs. Lower, it keeps a timer ($8660), reloaded each time from the kind's period plus a random 0-31, and each time the timer runs out it changes its mind about climbing ($8700). While it wants to climb it jumps for a platform it finds overhead, or across a gap at the end of its floor, fifteen steps up the arc. The shooter, the bottle thrower and the boulder roller are walkers with a shot added: one call in four, at random, a walker standing on a floor with no shot out and facing a player who is level with it readies one ($EDCD), and never when the player is lower. The hopper never walks: with the climb flag set and a platform within four rows overhead it jumps straight up, otherwise now and then it turns to face its player and hops the way it faces ($1F2E). The two flyers move every call, two pixels across and one or two up or down, reversing at walls, floors and ceilings ($EFC0, $EEB2). The dropper walks four pixels a call and, about once in twenty calls while its reload timer is out and a floor is under it, lets a bolt fall ($1E9F).

Once the round timer has run out every enemy is marked angry: its routine gets a second call on every second run of the actor loop, so it moves half as fast again ($16E4). An enemy that escapes a bubble is angry from then on.