From the archive
Tuning Canabalt
On September 29, 2010, for Canabalt's first birthday, its designer Adam Saltsman wrote up how the Flash version was tuned, in place of publishing its five-day source code. Habr, the Russian developer site, published a translation. Here are its numbers and the reasons behind them.
Semi Secret is an independent publication, not the studio that made these games; this page is an unofficial account written from the public record.
A wide, short window
Canabalt runs at 480 by 160 pixels, shown at double size on the web. The shape matters: it lets you see far ahead to react, while the short height keeps the view tight so speed feels intense. The world itself is 320 pixels tall, so the camera can drift up and down for big drops and the background buildings shift with depth.
The two background layers scroll at a fraction of the foreground's speed (0.15 by 0.1 for the far layer, 0.4 by 0.2 for the near one), so the city never blurs past even at top speed.
A forgiving runner
The runner is a 24 by 24 pixel sprite with 38 frames across four animations, but the game only counts a 12 by 14 pixel box at his feet, set well toward his back. There is little of him in front to clip a crate, and the box hangs far enough behind that you can run right off a roof and still jump at the last moment. Crates count as just 2 pixels tall, so almost any jump clears them.
Speed and jumps
- The runner starts at 100 pixels a second and tops out at 800, about 80 meters a second in the game's scale.
- Acceleration falls in steps as speed rises: 50 below 100, then 30, 20 and finally 10 above 400.
- A crate cuts speed by 30 percent, and the lower speed brings back the faster acceleration.
- Holding jump applies an upward speed of 300 pixels a second for up to 0.35 seconds, longer the faster you run.
- A tap under 0.08 seconds gives only 200, so a light touch makes a hop.
Even at full speed, with the runner at the far left of a 480 pixel screen, you have more than half a second to react, comfortably above human reaction time.
Rooftops built for your speed
The city is generated ahead of you from your current speed. The widest gap is about two thirds of your horizontal speed, so you can hit one crate and still make the jump. Hallway windows run 48 to 96 pixels tall depending on speed, a building is at least the screen width minus the gap (never under 96 pixels), and a roof never drops more than one screen height.
After every bomb, crane, window or collapsing building, the game waits three to eight ordinary buildings before the next one, which works out to about ten seconds of rest between crises. Each roof also reaches 8 pixels past its visible edge, so a jump pressed a moment late still lands.
The lesson
The post's own summary is that it is all about making things feel right, and removing the moments when a player is sure they made a jump the game says they missed. For anyone tuning a game, that is the useful part: forgiveness hidden in hitboxes and ledges makes a hard game feel fair.