← Experiments

CELLAGA(experiment)

A fixed-scroll shooter where ship, bullets, and debris are live Game of Life cells.

A fixed-scroll arcade shooter in which everything on screen is a cell in one Game of Life simulation: the ship, its shots, the enemy waves and the terrain. Two teams share the standard B3/S23 rule. Gliders are the player’s shots, a lightweight spaceship is the heavy weapon, and the ship itself is a pulsar, a pattern that repeats every three generations.

The ship has to stay alive under the rules

Nothing in the game protects the ship. It survives only because a pulsar sustains itself under B3/S23; an enemy cell that touches it changes its next generation like any other neighbor. Health is how much of the pulsar is still there: the live cells tagged as ship, divided by the count a healthy pulsar has at that phase (48, 56 and 72 for its three phases).

grid 2048 × 512shipreducetereadbackt / expected[tick mod 3]
Figure 1 Reading the ship's health. Every 8 ticks a shader reduces the 48 × 48 cells around the ship to one pixel: tagged live cells and enemy live cells. The CPU reads that pixel back asynchronously and divides the tagged count by the pulsar's expected count for the current phase.

Below 0.65 for three samples in a row (about 0.4 s), the pattern has fallen apart and the run ends. Overgrowth counts too: above 1.12 the ship slows, and above 1.28 for four samples the enemy has absorbed it. Damage is never a hit-point number, only what the rules did to the pattern.

Two teams on one grid

Each cell stores four bytes: alive, team, age, and a tag for cells that belong to the ship. Birth follows B3, with one change: the three parents must all be on the same team, and a ship tag passes on only when all three parents carry it.

ppppepbornempty(a)
see5 × 5(b)
Figure 2 Contact between teams. (a) A dead cell with three live neighbours is born only when all three are on one team; with mixed parents it stays empty. (b) An untagged player shot clears the enemy within two cells of it: enemy cells there die and enemy births there are blocked.

A player cell dies when two or more of its neighbors are enemy cells. Shots age as they fly and die at a fixed lifetime, sooner when they pass near enemy cells. → One Bit Short of a War — why classic Life can’t host a fight.

The GPU owns the grid

The world is a 2048 × 512 torus kept in two textures on the GPU, swapped each generation. A generation is three fullscreen passes: translate moves the ship’s tagged cells and clears the cells they leave; inject stamps shots, enemies and terrain from small pattern textures; step applies the rules. The CPU sends small patterns up and reads back only the reduced pixel of figure 1, through a pixel buffer and a fence it polls without blocking, one read at a time. → One Grain Per Cell Event — every birth and death as one audio grain.