LIKABLE GAMES
Developer notes

Inside Bumper Bash: building a real pinball table in a browser

Bumper Bash is our pinball table. You pull back the plunger, fire a silver ball up into a dome full of bumpers, and keep it alive with two flippers for as long as you can. Three balls, one score, and a jackpot waiting at the top of the table for anyone who earns it.

We gave ourselves one rule when we built it: nothing on rails. The ball is never pulled along a pre-drawn path, and no shot is scripted. Every bounce, every flipper shot and every lucky save is worked out from physics while you play. The table we studied as our benchmark was Space Cadet 3D Pinball, a classic table many grown-ups will remember. Here is what is going on under the glass.

What "real physics" means here

A game moves in frames: still pictures drawn one after another, usually around 60 a second, fast enough that your eyes see smooth motion. Every frame, Bumper Bash does three jobs for each ball. It pulls the ball down with gravity, moves it according to its speed, and checks whether it has hit anything. If it has, the ball bounces.

Bounces cost energy, the way they do with a real ball. When the ball smacks into a plain rail, the push it had going into the rail comes back at about 62%, so a ball that rattles around the walls slowly calms down. Other parts of the table add energy instead. The three round bumpers give the ball an extra shove outward every time it touches them, which is why they feel so lively, and the green slingshots just above the flippers kick it away hard.

The numbers took tuning. With heavier gravity or deader rails, the ball just churned around near the flippers and never climbed. We settled on values where a clean flipper hit can carry the ball all the way back up into the top dome. There is also a speed limit, so the ball never moves faster than the game can keep up with.

The problem with fast balls

Frames create a sneaky problem. The game only "sees" the ball once per frame, like a flipbook. At top speed the ball can cover around 30 pixels between one frame and the next, which is more than the ball's own width of 22 pixels. The rails it bounces off are thin lines.

So picture a ball one pixel in front of a rail in one frame, then 30 pixels further on in the next. In the first picture it has not touched the rail yet. In the second it is already past. If the game only checked those two pictures, the ball would pass straight through the wall without ever touching it. Game makers call this tunnelling, and it is a well-known trap in any game with small, fast objects.

Bumper Bash checks the ball's movement along its whole path instead. It chops each frame's movement into small steps, none longer than 5 pixels, and runs every collision check at every step. Five pixels is less than half the distance from the ball's centre to its edge, so there is no gap a rail can hide in. However fast the ball is going, it can never skip past a wall between checks.

Flippers that hit like flippers

Each flipper is a capsule: a straight stick with a rounded end on each side, like a pill or a sausage. The ball bounces off any part of it, including the rounded tip, so there are no sharp corners for it to snag on.

When you press, the flipper snaps up fast. When you let go, it drops back a little more slowly. While it swings, the game works out how fast the exact spot the ball is touching is moving, and hands that speed to the ball. A flipper turns around its hinge, so the tip moves much faster than the part near the hinge. Think of a tennis racket: a ball that meets the end of the swing flies off harder than one that hits near your hand.

That is why timing matters. Flip too early and the flipper has already finished swinging when the ball arrives. It is just a still slope, so the ball bounces off it gently. Flip as the ball arrives and it meets the flipper at full swing speed, plus a little extra kick the game adds whenever a flipper is moving fast. Where along the flipper you catch the ball changes the angle it leaves at, so flicking late versus early really does change the shot.

The scoring chain

Everything you hit is worth something, and the best scores come from a chain of goals that build on each other.

What you hitPointsWhat else happens
Slingshot50Kicks the ball away
Bumper100Shoves the ball outward
Saucer, jackpot not lit250Spits the ball back down
Drop target500The target drops flat
All five targets down5,000Multiplier goes up by 1 and the jackpot lights
Saucer with jackpot lit10,000"JACKPOT!" plus two extra balls: "MULTIBALL!"

The chain goes like this. Knock down all five yellow drop targets in the middle of the table and the jackpot lights up, the multiplier climbs, and a fresh row of targets pops up a moment later. Then shoot the ball into the saucer at the very top. While the jackpot is lit, the saucer pays 10,000 and fires two extra balls out onto the table, as long as there are fewer than three already in play.

Every score is multiplied by your current multiplier, which can climb as high as 6×. It drops back to 1× when you lose a ball. During multiball, though, a ball only counts as lost when the very last one drains, so the extra balls are a free chance to rack up points.

Making sure the ball never gets stuck

Real physics brings real problems. A ball that is free to go anywhere is also free to wedge itself somewhere silly and stop the game. So the table has a few quiet safety features:

  • The sloped walls at the bottom run right up to each flipper's hinge, within about 5 pixels, so there is no pocket for the ball to jam into.
  • The plunger lane has a one-way gate. It lets the ball out on the way up and turns solid once the ball is clear, so a ball can never fall back into the lane and strand you.
  • Even the weakest plunger pull is strong enough to clear the lane. Holding longer just gives you a harder launch.
  • The saucer always nudges the ball back down after it scores, so it cannot sit in the hole forever.

Rails you can see

The first versions of the table had a plain dark playfield, and the rails showed up fine. Then we put a painted, illustrated playfield under the table, and the rails started to disappear into the artwork. That matters more than it sounds. A ball bouncing off a wall you cannot see looks like a glitch, even when the physics is right.

So every rail is now drawn in three layers, stacked on top of each other:

  1. A dark outline, the widest layer, so the rail stands out against any colour behind it.
  2. A bright body on top: blue for ordinary rails and green for the slingshots, so you can tell which walls kick.
  3. A thin white highlight along the top edge, nudged slightly upward, so the rail reads as shiny metal catching the light.

We also lay a dark wash, about a third of full strength, over the painted art. The picture is still there, but it sits back and lets the hardware on top of it pop. Comic artists do something similar when they ink a dark line around a character so it never gets lost in a busy background.

What it adds up to

None of this is visible when you play, and that is the point. You should never think about frames, capsules or one-way gates. You should just feel that the ball went where it should, that a late flick did something different from an early one, and that when you lost a ball, it was a fair fight.

Give it a go at Bumper Bash, and try aiming for the drop targets before you chase the saucer. If you enjoy reading about how the games are made, our post on how Turbo Rush draws a curving road without any 3D covers a different trick from the same toolbox. Parents can find a quick overview of every game in our parents' guide.

Games in this post