Blastboard is a free cube shooter puzzle that runs in the browser. You fire coloured jelly up columns at a board of cubes, matching colours pop in chains, and a hidden picture appears as the board clears. It is the second game in our series of small Three.js puzzles, after Frostpush, and it reuses most of that game’s structure. This post covers what was new: chain popping, generating levels that are always solvable, rating their difficulty, and the details that make popping cubes feel good.
The rules as pure functions
As with Frostpush, the rules live in one module with no graphics code. The board is a grid of cells, each empty or holding a cube, a frosted cube, a stone or a bomb. The core function is fire(board, column, colour). It finds the first filled cell in that column, counted from the shooter’s side, and returns a new board plus a list of events: a hit, a miss, each pop, each cracked frost and each bomb blast. The renderer only animates those events.
Keeping the rules pure paid off again. The same functions run in the browser, in the level generator, in the solver and in the automated tests.
Chains are a flood fill
When a jelly hits a cube of its own colour, every cube of that colour connected to it pops too. That is a flood fill: start at the hit cube, look at its four neighbours, add any that match, and keep going until nothing new is found. A small stack and a set of visited cells are all it needs.
Frosted cubes join the fill like normal cubes, but instead of popping they lose their ice. Bombs come after the fill. Any bomb directly next to a popped cube goes off and clears the eight cells around it, except stones, and bombs caught in a blast go off in turn. A queue handles those chain reactions.
Generating levels that always work
The shot queue is fixed, so a level is a board plus a list of jelly colours. The risk is obvious: a random board with a random queue is usually impossible. We avoided that by generating the queue from the board.
- Build a board with clustered colours: each cell has a good chance of copying the colour of the cell to its left or above, which makes the satisfying big groups.
- Add stones, frost or bombs, depending on which set of levels it is for.
- Play the board with a random but sensible player: at each step, pick any column whose front cube can be popped and fire a jelly of exactly that colour.
- Record the colours it used. That list becomes the level’s queue.
Because a real sequence of shots cleared the board with that queue, the level is guaranteed to be solvable. Boards where the random player got stuck facing only stones and bombs were thrown away.
A solver for the fewest shots
The generated queue proves the board can be cleared, but not how quickly. Chains and bombs often allow a faster clear, and that fewest-shots number sets the three-star target. The solver is a depth-first search over “which column do I fire this jelly into”, with two shortcuts:
- Memoising states. The same board with the same position in the queue is only explored once.
- Wasted shots are all the same. Firing a jelly into any column where it does not match changes nothing but the queue position, so the solver tries one wasted shot at most, not one per column.
A verification script solves every level and fails if any board cannot be cleared or if the stored fewest-shots number is wrong.
Rating difficulty with random players
Solvable is not the same as fun. To order the levels, the generator also plays each board 300 times with random sensible players using the fixed queue, and counts how often they win. A board that random players clear every time is gentle. One they clear 13 percent of the time needs real planning.
We picked boards across that range for each set, easy first, and gave the early boards a jelly or two to spare. The first board ended up hand-made. The generated one was a full board of 63 cubes, too much for a tutorial, so we replaced it with a small board of four colour layers that teaches chains in four shots.
The camera and aiming
Frostpush used a true isometric angle. For a shooter, columns need to read as lanes, so Blastboard’s orthographic camera sits behind the shooter, tilted down and turned only slightly. The board fitting is the same as before: project the level’s bounding box into camera space and size the view to fit, leaving room for the top bar.
Aiming uses a ray from the camera through the mouse or finger onto a flat plane at cube height. Where it lands, rounded to the nearest whole number, is the column. Mouse users get a highlighted lane that follows the pointer. Touch users just tap a column to fire.
Making pops feel good
A cube shooter lives or dies on how the popping feels, so this got the most polish for the least code.
- Ripples. Cubes in a chain do not vanish at once. They pop in order of distance from the hit cube, a few hundredths of a second apart, so a chain visibly spreads.
- Rising pitch. Each pop in a chain plays a short tone a little higher than the last, so a big chain climbs like a scale.
- Squash and particles. Each cube swells, shrinks and bursts into small cubes of its colour. Bombs throw a larger burst and briefly flash the background.
- Rounded jelly. The cubes use Three.js’s rounded box geometry with a glossy material, which reads as jelly rather than plastic.
The picture reveal
Each board hides a 7 by 9 pixel picture: a heart, a mushroom, a penguin and so on. The pictures are written as rows of letters in a small file, one letter per colour, and the floor tiles are coloured from them when a level loads. No image files are involved, which keeps the game light.
Testing it end to end
The solver checks the rules, but we also wanted to know that the real game behaves the same way. A small test hook lets a headless browser fire shots into the running game. The test loads each level, fires the solver’s shots one by one, waiting for each animation to finish, and checks that the level-cleared card appears. All 20 boards passed.
What carried over and what we would reuse
Most of Frostpush carried straight over: the email screen, analytics bridge, sound, saved progress, styles and the page template. Building Blastboard was mostly the rules, the generator and the renderer. For the next games, the generate, solve, rate and replay pipeline has become our standard way to build puzzle levels quickly without shipping a broken one.
You can see the result by playing Blastboard.