On this page
The flight model
Everything a flappy game feels like comes from four numbers. Change any of them and the game becomes a different game, which is why we publish ours rather than describing them vaguely.
| Value | Our standard | What it controls |
|---|---|---|
| Gravity | 1,500 units/s² | How fast falling accelerates |
| Flap force | −430 units/s | The upward velocity a flap sets |
| Max fall speed | 620 units/s | How fast you can ever fall |
| Max rise speed | −520 units/s | How fast you can ever climb |
The critical detail is that a flap sets velocity rather than adding to it. If flaps added, then rapid tapping would accumulate into an uncontrollable launch and the game would reward mashing. Because a flap sets, tapping twice quickly is barely different from tapping once, and the skill moves from how fast you press to when.
The two speed caps are what make the game fair rather than merely hard. A capped fall speed means a long drop is always recoverable if you start the recovery in time — there is no state you can reach from which nothing works. A capped rise speed means the ceiling is reachable but not instantaneous, so an over-flap is a mistake rather than a death sentence.
Rotation is cosmetic but matters enormously for readability. The flyer's body angle chases its velocity with a deliberate lag, which is what reads as weight. Snap the rotation to the velocity exactly and the same game feels weightless and cheap.
The game loop
Every game on this site runs the same loop, driven by requestAnimationFrame, which synchronises to the display's refresh rate and pauses automatically when the tab is hidden.
- Measure the frame time. The difference between this frame's timestamp and the last, in seconds.
- Clamp it. Never step more than 50 milliseconds at once, so a stall does not teleport the flyer through a pillar.
- Read input. Collect what was pressed since the last frame, including taps, and clear the edge flags afterwards so one press is one flap.
- Apply physics. Gravity, the flap impulse, the speed caps, position.
- Update the world. Scroll obstacles, spawn what is due, retire what has left the stage.
- Check collisions. Flyer against obstacles, floor and ceiling.
- Score. Anything passed since the last frame.
- Render. Background, obstacles, collectibles, flyer, effects, HUD.
The clamp in step two is the least obvious and the most important. Frame times spike when a browser tab regains focus, when the garbage collector runs, or when a laptop throttles. Without a clamp, a 400-millisecond frame moves the flyer 250 units in one step, which can place it on the far side of a pillar without ever having intersected it. Clamping turns a stall into a small stutter instead of an unexplained death.
Delta-time is multiplied into every movement, which means the game runs at the same speed on a 60 Hz laptop and a 144 Hz monitor. Games that move a fixed number of pixels per frame — and there are many — run more than twice as fast on high-refresh displays.
Obstacle generation
A flappy obstacle field is produced by a small number of rules applied repeatedly. Ours generates one gate at a time, each with a gap height and a gap centre.
Gap height
Interpolated between a starting value and a floor, driven by the difficulty ramp. Our standard game starts at 205 units and stops at 150. The floor is set at roughly five flyer diameters, which leaves room for the flyer plus one full correction at terminal fall speed.
Gap centre
Chosen relative to the previous gate rather than at random. The new centre must sit within a maximum vertical distance of the last one — derived from how far the flyer can climb in the time the current scroll speed allows — and never within 26 units of the ceiling or floor.
That second rule is the whole of fair generation. Without it, a purely random field will eventually produce a ceiling gap immediately after a floor gap at a speed that makes the climb physically impossible, and the player will correctly conclude the game cheated. With it, every sequence the generator can produce has a flyable line through it.
Spacing
The horizontal distance between gates shrinks as difficulty rises, from 300 units to around 210. Note that spacing in distance combined with a rising scroll speed means the time between decisions falls twice as fast as either number suggests, which is why late-run difficulty escalates more sharply than the individual curves look.
Collision detection
The flyer is treated as a circle, which is both cheaper and fairer than a rectangle for a rounded sprite. Its collision radius is deliberately about 82% of its drawn radius, so the visible edges of wings and beak do not kill you. That forgiveness is standard practice in arcade games and it is why a near miss feels like a near miss rather than a cheat.
- Against a gate — circle against two axis-aligned rectangles, using the closest-point test. Cheap and exact.
- Against a rotating bar — sampled along the bar's length as a series of circles. A rotated rectangle test would be more precise on paper and less predictable in practice, because the corners of a fast-spinning bar move very quickly.
- Against a corridor — the slice nearest the flyer is checked against its top and bottom edges. Continuous walls have no corners to miss.
- Against a beam — an ordinary rectangle test, but only while the beam is above half power, which gives the ramp-on a real margin.
There is no continuous collision detection anywhere on the site, and it is not needed: the 50-millisecond frame clamp means the flyer can never move more than about 31 units in a single step, which is smaller than every obstacle it can hit.
Scoring and combos
The base scoring rule is one event, one score: a gate passed, a ring threaded, a collectible taken. On top of that sits a combo multiplier that rises with consecutive successes and resets on a mistake.
The multiplier is deliberately a consistency reward rather than a speed reward. It climbs by 0.1 per chained success up to a cap, which means twenty clean gates are worth substantially more than thirty gates with two crashes in the middle. That has a real strategic consequence: cautious flying usually out-scores aggressive flying, which is not what most players assume when they start.
Perfect passes — threading the central band of a gap rather than scraping an edge — award a bonus and accelerate the multiplier. That mechanic exists to give the player feedback about how they flew rather than only whether they survived. Without it, a clean centre line and a desperate scrape score identically, and the game silently endorses the scrape.
The difficulty curve
The last piece is how everything above changes over time. We use an exponential approach rather than a linear climb, for a specific reason.
A linear ramp rises forever. That guarantees that every run ends at the point where the game becomes physically impossible, which means the score measures how long it took you to reach that wall rather than how well you played. An exponential approach rises quickly at first and then flattens toward a ceiling — about half the total change has happened within twenty seconds, and the last fraction never quite arrives.
The consequence is that a practised player can reach the ceiling and hold it indefinitely. Runs then end because concentration slipped, which is a far more satisfying and more improvable failure than hitting a wall. It is also why endless scores tend to plateau and then jump: players grind out small gains, then find a rhythm that works at the ceiling and add a large chunk at once.
For the mathematics and the tuning targets behind this, see how arcade difficulty progression works.
Key takeaways
- A flap sets vertical velocity rather than adding to it, which is what stops rapid tapping from being a strategy.
- Clamping the frame time to 50 ms prevents a browser stall from teleporting the flyer through an obstacle.
- Fair generation comes from limiting how far consecutive gap centres can move, not from clever randomness.
- The flyer's collision radius is about 82% of its drawn size, which is why near misses feel like near misses.
- Difficulty approaches a ceiling rather than climbing forever, so runs end on concentration rather than on a wall.