Thimiola's Toilet
THIMIOLA Research Archive · Technical briefing

How the poop physics works

Last updated: 15 October 2026

Thimiola's Toilet looks like a silly cartoon, and it is. Underneath, though, is a small real-time physics engine written from scratch for this game. Nothing is pre-animated: every coil, splat and flood is calculated live, sixty times a second, in your browser. This page explains how, without needing any maths.

1. Poop is a rope of beads

The game models each stream as a chain of small round particles, like beads on an invisible string. In the story this is the Poop Rope Neural Network™; in physics it's called a soft-body rope. While you hold the button, the last bead stays stuck to your cursor (the "nozzle"). Every time the rope has grown by about one bead width, that bead is released and a new one takes its place. That's why the stream feels continuous instead of coming out in lumps.

Diagram: a chain of linked particles leaving the nozzle, with distance links between neighbours and weaker bending links skipping one bead nozzle fixed distance bending link
Each bead is linked to its neighbours. A weaker link to the bead after next resists folding, which is what makes the rope coil into a pile instead of collapsing like wet string.

Two kinds of link hold a rope together. A distance link keeps neighbouring beads one step apart, so the rope can bend but not stretch. A weaker bending link between every bead and the one two places further along resists being squashed together. That second link is what makes a long stream fold over itself and stack into the classic cartoon swirl. Make the bending link stronger and you get stiff, log-like pieces; make it almost zero and you get something closer to liquid. The five matter types are mostly different settings of these same few numbers.

2. Lots of very small steps

Each bead remembers where it is now and where it was a moment ago. The difference between the two is its speed, so the game never stores velocity separately. This method is called Verlet integration, and it's popular in games because it stays stable even when lots of things push on each other at once.

Every frame (1/60 of a second) is split into up to six smaller substeps. In each one the game moves every bead under gravity, pulls the links back to the right length, and pushes apart anything that overlaps. Fixing things a little at a time, many times a second, is called position-based dynamics. It's the same family of techniques used for cloth, hair and ropes in many modern games.

Gravity is a strong 2,000 pixels per second squared, which is roughly what makes things fall at a believable speed at this screen scale. Speed is also capped per substep, so a fast-falling bead can never jump straight through a wall or the toilet between two steps.

3. Thousands of collisions, checked quickly

A busy bathroom can hold up to 9,000 particles. Checking every particle against every other one would mean about 40 million checks per substep, which no browser could do sixty times a second. Instead, the screen is divided into an invisible grid of small cells, and each particle only checks its own cell and its nearest neighbours. Each pair is visited once, so the work grows with the number of particles, not with its square.

When two beads overlap, they are pushed apart, and friction slows how they slide over each other. Friction is different for every matter type: hard logs grip and stack, while diarrhea slides over everything. Beads that sit right next to each other on the same rope are skipped, so a rope doesn't fight itself.

4. The toilet is a "distance map"

The toilet has a complicated curved shape, and testing beads against all of its curves directly would be slow. So when the game starts (and whenever the window changes size) it builds a signed distance field: a fine grid that stores, for every point around the toilet, how far it is from the nearest porcelain surface and in which direction. Negative means "inside the porcelain".

During play, a bead just looks up its position in that grid. If the number is smaller than the bead's radius, it's touching, and the grid also tells it which way to be pushed out. One quick lookup replaces dozens of geometry tests, and it works for any shape, including the inside of the bowl.

5. Tearing off and shattering

Squeeze from too high and the stream tears off under its own weight. The game counts how many beads are hanging in the air below the nozzle with nothing underneath them. Past a limit, the link at the nozzle breaks. Stiff hard logs can hang a long way (46 to 60 beads); diarrhea can only manage a handful, which is why it falls in drips and globs.

Shattering is the opposite end of the fall. The game remembers how high each bead was the last time it was resting on something. When it lands, it shatters only if all of these are true:

When all four hold, about 26 beads around the impact are cut into small chunks of three to eight beads, which fly off "upwards" relative to gravity, with splatter drops and floor stains. Pellets never shatter, because they're already in pieces.

6. Water that keeps its level when you tilt

When you tilt your phone, the water in the bowl leans over but keeps the same amount of water. The game treats the inside of the bowl as a shape and slices it with a straight line at right angles to gravity: everything below the line is water. Each frame it searches for the line position that gives exactly the right area, by repeatedly halving the search range (a bisection search).

If you tilt far enough that the lower rim goes underwater, water spills out, the bowl loses that amount, and the tank slowly refills it. Spilled water becomes a puddle on the floor that spreads out and runs downhill when you tilt.

Diagram: the same bowl level and tilted; the water line stays at right angles to gravity and the water area stays the same gravitytilted levelsame area
The water surface always sits at right angles to gravity. The game finds the level that keeps the water's area the same, so tipping the toilet really can pour a clog out.

7. Clogs and floods

The game keeps a running total of how much matter is in the bowl, weighted by volume so a thin trickle counts less than a thick log. A normal flush lasts three seconds: the water dips, everything in the bowl is pulled towards the drain, and it disappears. Once the bowl holds more than the clog limit, the flush button turns red.

Below 90% of the limit, the toilet forgets the first strike. The escape route is physical, not a menu: tilt the phone (or hold the arrow keys) to tip the toilet and pour the clog out, then flush.

8. Gravity from your phone

On phones and tablets, the game reads the device's motion sensors through the browser. Your phone's tilt is turned into a gravity direction on the screen, so poop, droplets, puddles and the bowl water all slide the way you lean. Lying the phone flat gives weak, floaty gravity (never less than a quarter of normal). A sharp shake, measured by the accelerometer, flings everything around, and hard shakes break pieces apart. On a computer, the ← and → keys tilt the room and S shakes it. Browsers only allow motion sensors on secure (https) pages, and iPhones ask for permission on the first touch.

9. Every sound is made on the fly

There are no audio files in the game. Every sound, including the farts, is generated live with the browser's Web Audio API. The fart "voice" mixes two buzzy oscillators, shapes them through a distortion curve and a resonant filter, wobbles the volume, and adds filtered noise for wetness. Each matter type gets its own pitch, wobble and wetness, so a hard log groans differently from a runny stream. Plops, splats, gurgles, flushes and the explosion boom are built the same way.

10. Keeping it fast on phones

The whole game is a single web page with no libraries or frameworks, about 160 kilobytes, and it keeps working offline once it has loaded.

Try it yourself: drop a hard log from the very top of the screen, then try the same with soft serve held just above the bowl. Same engine, very different results. More experiments are on the tips page.
▶ Play Thimiola's Toilet