What it does
A chain of balls is pushed from behind along a track, rushing out at the start and then rolling at the level's pace. The shooter aims and fires the ball it holds, which is always a colour still in the chain, and can swap it with the next one. Where a shot hits, it goes into the chain, before or after the ball it hit depending on which side it came in, and the balls ahead are pushed on by a ball's width, nearer the hole.
Three or more of a colour together pop, and the chain splits. The part behind is still pushed; the part ahead stops. If the balls either side of the gap are the same colour, the part ahead rolls back to meet the rest, and if that makes three it pops again, as a combo worth more each time. A pop scores ten a ball, times one more for each step of the combo, and three popping shots in a row or more add a streak bonus. The game is lost when the front ball reaches the hole and won when every ball has popped.
You call aimAt, shoot, swap and step, and draw from view, which gives every ball's colour, position and angle
along the track, the shots in flight, the shooter and how far the front ball has come. Events tell you about shots,
inserts, pops, roll-backs, joins, misses, swaps, danger near the hole, and the win or loss. An autopilot plays the
game for an attract mode or a test.
Features
- A pushed chain — balls roll along the track from behind, with a fast rush-in at the start.
- Inserted shots — a shot goes into the chain where it hits and pushes the balls ahead on.
- Pops and splits — runs of three or more pop, and the chain splits into a pushed part and a stopped part.
- Roll-back combos — matching ends roll back together and can pop again, worth more each time.
- Fair shots — the shooter only ever holds colours still in the chain, and the chain starts with no three alike together.
- Swap — exchange the held ball with the next.
- Tracks by arc length — polylines or spirals, with a place and direction at any distance along.
- Three built-in levels — a spiral, a serpent and a long spiral.
- An autopilot — aims at the longest run it can make, favouring balls near the hole.
- Snapshot and restore — the whole game as plain JSON.
Good for
- Chain marble shooters, in the style of Zuma or Luxor, with a spiral or a winding track.
- Casual level packs, each level a new track shape, chain length, colour count and pace.
- Attract modes and demos, played by the autopilot.
- Minigames inside larger games, since it draws nothing and runs from a handful of calls.
Make it yours
A level is a name, a track, the shooter's position, the number of balls, the number of colours (one to eight), the chain's speed and an optional rush-in speed and distance. A track is a list of points or a spiral defined by its centre, outer and inner radius and turns. Around the level you set the seed, a ball's width, how fast a shot flies and a split chain rolls back, and how far a shot travels.
Two different games from the same rules: a gentle spiral of 60 balls in four colours, pushed slowly towards the centre after a fast rush-in; and a longer winding serpent of your own polyline with more colours, a quicker push and larger balls, for a hard late level.
A quick look
A built-in level, aimed at the pointer, shot, stepped and drawn:
const z = game.rail.create({ level: game.rail.levels[1] });
z.aimAt(Math.atan2(pointer.y - frog.y, pointer.x - frog.x));
if (clicked) z.shoot();
z.step(dt);
for (const b of z.view().balls) drawBall(b.colour, b.x, b.y, b.s);
Works with
bubbleshooter— for bubbles fired up into a hanging grid rather than a chain on a track.match3— for swapping tiles to match three.particles-2d— for bursts when balls pop.
Good to know
- Power-up balls (slow, reverse, accuracy and bombs), coins, tunnels where the track passes under itself and levels with two tracks are not modelled.
- One shooter per game, at a fixed position for the level.
- The pack draws nothing: your game draws the track, the balls and the shooter from
view.






