How Do Physics Games Work? A Plain-English Guide

How Do Physics Games Work? A Plain-English Guide

A physics game runs a small simulation dozens of times a second. On each tick, a piece of software called a physics engine moves every object a little according to its speed, pulls it down with gravity, checks what’s touching what, and pushes overlapping objects apart with believable bounce and friction. The game then draws the result and repeats. The designers choose the numbers (how heavy, how bouncy, how slippery) to make it fun, not to match reality exactly.

That’s the whole trick. Everything else is detail about how to do it quickly and without things exploding.

What is a physics engine? #

A physics engine is a library of code that does the motion and collision math so game developers don’t have to write it from scratch. Two well-known 2D engines:

  • Box2D, written by Erin Catto. It started as a demo for a 2006 game developers’ conference talk and was released as open source in 2007. The original Angry Birds used it, and so did games like Crayon Physics Deluxe, Limbo and Tiny Wings.
  • Matter.js, a 2D engine for the web by Liam Brummitt. It handles rigid bodies, collisions, friction, gravity and constraints. Kitty Kaboom, our cats-vs-robots slingshot game, is built on it.

Big general-purpose game engines like Unity and Unreal come with physics systems built in, which is why so many 3D games have similar-feeling physics. We compare the options in what physics engine Angry Birds uses.

The loop: lots of tiny steps #

Games don’t calculate a flight all at once. They advance time in small, fixed slices, usually 1/60 of a second, which is about 16.7 milliseconds. Kitty Kaboom steps its physics exactly that way. Each step does roughly this:

  1. Apply forces. Gravity adds a little downward speed to everything that isn’t fixed in place.
  2. Move. Each object’s position changes by its current speed.
  3. Detect collisions. Find every pair of objects that now overlap.
  4. Resolve collisions. Push them apart and change their speeds so they bounce, slide or stop.

Repeat 60 times a second and you get smooth, believable motion. The fixed step matters because physics math is sensitive to the size of the time slice. Steps that are too big let fast objects jump clean past thin walls between two frames, a bug players call tunneling or clipping.

Rigid bodies: shapes, not pixels #

The engine doesn’t see the cute cat or the brick texture. It sees simple shapes, mostly circles, boxes and polygons, called rigid bodies because they don’t bend. Each body has a few numbers attached:

  • Density, which with the shape’s area gives its mass
  • Friction, how much it resists sliding
  • Restitution, how bouncy it is, from 0 (no bounce) to near 1 (very bouncy)

In Kitty Kaboom every cat is a circle, and the blocks are rectangles or circles. The game’s own material settings show how much those three numbers shape a level:

MaterialDensityFrictionRestitutionWhat you notice
Cardboard0.00180.40.15Light, flies around
Metal0.0090.50.15Five times denser than cardboard
Soap0.00160.010.1Almost no friction, so stacks slide apart
Pink cushion0.0020.30.95Nearly a perfect trampoline

When two bodies touch, the engine has to combine their values. Matter.js uses the larger of the two restitution values and the smaller of the two friction values, according to its documentation. That’s why anything bounces off a Kitty Kaboom cushion, and why anything slides on soap. For more on bounce, see why some things bounce more than others.

Gravity is a design choice #

Real gravity accelerates things at about 9.8 meters per second squared, but a game world has no meters. Designers set gravity to whatever makes arcs look and feel right on screen. Kitty Kaboom sets its engine gravity to 2.5 in matter.js units, a value picked for how the shots feel on a phone, not to imitate Earth. Floaty games use weak gravity. Snappy ones use strong gravity.

Once gravity is fixed, everything launched follows a curved path whose shape depends on launch speed and angle. That’s the same parabola you’d study in a physics class, and it’s why the aiming skills from one slingshot game carry over to another. Our slingshot aiming technique guide uses it.

Collisions: find them, then fix them #

Checking every object against every other object would be slow, so engines work in phases. A quick, rough pass throws out pairs that are obviously far apart. A precise pass checks the remaining pairs for real overlap. Matter.js describes these as broad-phase, mid-phase and narrow-phase detection.

Then comes resolution. The engine moves overlapping bodies apart and changes their velocities so momentum is roughly conserved, bounciness is respected, and friction slows sliding. This is the part that makes a tower topple convincingly instead of two boxes melting into each other.

Why towers don’t explode when a level starts #

Stacks of objects are hard for physics engines. Tiny overlaps in the starting layout can produce a violent shove on the first frame, and a carefully built tower can collapse before you’ve done anything. Engines handle this with extra solver passes and by letting objects that have stopped moving “sleep.”

Kitty Kaboom adds its own fix: when a level loads, it quietly runs about a second of simulation with damage switched off and speeds damped, so everything settles before you see it.

Damage and destruction are game rules #

Physics engines move and bounce things. They don’t break them. Breaking is a rule the game adds on top. In Kitty Kaboom, each block has hit points and each collision deals damage based on the impact speed and the mass involved. When a block’s hit points run out, the game removes it and throws debris effects on screen. Battery packs go further: when one breaks, the game applies an outward push to everything nearby, which is all an explosion really is in a 2D engine.

Ropes, chains and pendulums #

Engines also support constraints, rules that link two bodies or pin a body to a point. A rope in Cut the Rope, a hanging wrecking ball, a bridge in a construction game: all constraints. Kitty Kaboom’s wrecking balls and swinging washline platforms are pinned to fixed points above the level, so hitting them makes them swing like pendulums.

Why the same shot plays out differently #

Physics games are sensitive to tiny differences. A shot a single pixel higher hits a block a fraction lower, which spins it slightly differently, which changes how the whole tower falls. That’s why no two collapses look the same, and why aiming strategies work in general but not identically every time.

The part that isn’t physics: game feel #

A lot of what makes a hit feel great isn’t simulation at all. Kitty Kaboom briefly pauses the physics for a split second after a heavy impact, a trick called hit-stop, and shakes the screen and the phone. Those touches are pure presentation, and they’re a big reason destruction games feel satisfying.

Frequently asked questions #

Do physics games use real physics? #

They use simplified Newtonian physics: objects keep moving until something stops them, gravity pulls them down, and collisions push them apart. The numbers are tuned for fun, so gravity, weight and bounciness are rarely realistic.

What physics engine did Angry Birds use? #

The original Angry Birds used Box2D, a free, open-source 2D physics engine by Erin Catto. Many other 2D games of that era used it too.

Why do objects sometimes glitch through walls in games? #

Usually because something moved so far in one time step that it skipped past a thin wall without ever overlapping it. Engines reduce this with smaller steps and special handling for fast objects.

Can physics games teach you real physics? #

They build good intuition for gravity, momentum, balance and bouncing, even though the numbers are made up. They won’t teach you formulas, but they make the ideas behind them feel familiar.