How Bump Theory Simulations Are Made
Every video on the Bump Theory channel is a small computer program. There is no filmed footage, no hand-animated motion and no stock music. A ball bounces where the physics says it bounces, and the counter shows what really happened. Here is how one gets made, step by step.
1. Start with a rule you can say in one sentence
Every video begins with a rule: "every time the ball hits the wall, it splits in two", "every bounce shrinks the ball and grows the wall", "when a red and a blue ball touch, the faster one wins". The rule is the whole video, so it has to be understood in the first two seconds and it has to be exactly what the code does. If the screen says every hit makes a new ball, then every hit makes a new ball: no hidden cooldowns, no secret caps, no balls quietly removed.
2. Build a tiny world
The world is simple: an arena (usually a ring or a box), and a list of balls. Each ball has a position, a velocity and a radius, and sometimes a colour or a health value. Some videos have gravity; many are zero gravity, where balls fly in straight lines at constant speed until they hit something. Walls can move, spin, shrink or break.
3. Move time forward in fixed, small steps
A computer can't simulate smooth time, so it fakes it with tiny jumps. Each jump, every ball moves by its velocity times the step length, then the program checks what it hit and reacts. The videos run at 60 frames per second, and the physics usually takes several smaller steps per frame: three steps per frame means 180 physics steps every second.
Two choices here matter a lot. First, the step is fixed: always the same length, never stretched when the computer is busy. With a fixed step and the same starting point, the simulation produces exactly the same result every single time. Second, the step is small. A fast ball moving in big jumps can leap straight over a thin wall without ever touching it, a glitch known as tunnelling. Smaller steps catch the hit.
The "random" starting positions come from a random number generator with a fixed starting value, called a seed. Same seed, same video. We often try many seeds and pick one with good pacing, for example one where the first split doesn't happen in the first second. But once the seed is picked, every frame you see is exactly what the physics produced.
4. Collisions: overlap, push apart, bounce
Two round balls touch when the distance between their centres is less than the sum of their radii. A ball touches a wall when its centre is closer to the wall than its radius. When that happens the program does two things:
- Push apart. Move the objects so they no longer overlap, otherwise they stick together or jitter.
- Bounce. Split the velocity into the part pointing into the wall (along the wall's normal, the direction straight out of the surface) and the part sliding along it. Flip the first part and keep the second.
In symbols, with velocity v, unit normal n and bounciness e (1 means a perfect bounce with no energy lost):
vafter = v − (1 + e)(v · n) n
Ball-on-ball collisions use the same idea along the line joining the two centres, sharing the push according to their masses. For more complicated shapes, such as gears, polygons and presses, we use Pymunk, a free and open-source 2D physics library built on the Chipmunk engine, and add our own rules on top.
5. Counters that are checked, not animated
The counter on screen is not a separate animation that someone tuned to look exciting. It is a variable in the program, changed by the very same line of code that creates or removes a ball. On top of that, the code checks itself: it asserts that the number of balls equals the starting number plus every split it recorded (minus anything lost, if the rule allows losses). If those ever disagree, the render stops with an error.
This rule exists because of a real mistake. An early draft of one video had a tiny hidden cooldown, a fraction of a second after each hit where a new hit didn't count. On screen, the numbers stopped adding up. The cooldown was removed and the self-check was added to every video after that.
6. Simulate everything first, then draw
The whole timeline is simulated before a single frame is drawn. The program records where everything is at each frame, plus a list of events: every hit, split, crack and escape, with its exact time. Only then does drawing start.
Each frame is drawn as vector graphics with Cairo, a free 2D graphics library, at 1080 × 1920 pixels (a vertical phone screen). A 30-second Short is 1,800 frames. The frames are drawn in parallel on several processor cores and streamed straight into FFmpeg, which encodes them as an H.264 video. Because frame 0 and the last frame are drawn by the same code, a video can end on exactly the picture it started with, so it loops seamlessly when YouTube replays it.
7. A sound for every bounce
The sound is built from the same event list, so every note lands on the frame where its collision happens. No recorded instruments are used. A marimba-like note, for example, is made from three sine waves that fade at different speeds: the main pitch, plus quieter tones at about 4 and 10 times its frequency, which is roughly how a real marimba bar rings.
A few tricks keep thousands of hits from turning into noise. Notes are picked from a pentatonic scale, five notes that sound pleasant in any combination. The number of notes per second is capped (for example at 60), so a crowd of 5,000 balls becomes a shimmer instead of a roar. "Which song is the ball playing?" videos go further: the bounce angle and speed are worked out so that every hit lands on the beat of a public-domain melody such as Ode to Joy.
Finally the audio is mixed and its loudness is measured with the EBU R 128 method and set to about −14 LUFS, a common level for online video, so it isn't much louder or quieter than the videos around it.
8. Checks before anything is posted
- Stills: the first frame, a few middle frames and the last frame are saved as pictures and looked at closely.
- Loop check: the first and last frames are compared pixel by pixel; the difference has to be almost zero.
- Loudness check: the finished file is measured again.
- Edge check: the picture has to reach every edge of the frame, with no empty bars.
Why bother doing it this way?
Because the honesty is the point. Viewers count along, argue in the comments about whether the maths adds up, and ask "what if" questions. When the physics and the counter are real, every one of those questions has a true answer, and the next video can test it. The same approach powers the 1 Ball → 10,000 game on this site, rewritten in JavaScript so the physics runs live in your browser.
See it in action. Watch the simulations on YouTube, or build your own multiplying-ball machine in the game.
Play 1 Ball → 10,000 Watch Bump TheorySources
- Fiedler, G. Fix Your Timestep! (why fixed physics steps give stable, repeatable simulations). gafferongames.com
- Pymunk, a 2D physics library for Python built on Chipmunk2D. pymunk.org
- Cairo 2D graphics library. cairographics.org
- EBU R 128: Loudness normalisation and permitted maximum level of audio signals. tech.ebu.ch/publications/r128