2026-09-26

How it works: every leg is simulated

Bugfu has no animation files. Nobody keyframed a spider walking, a scorpion stinging or a mantis striking. Every leg of every bug is simulated, fifty times a second, on the server, and what reaches your screen is a small, exact picture of that simulation.

This page is the short version of how.

One engine, in two places

The engine that moves a bug is plain JavaScript, and the same files run in two places: on the game server, where they decide what happens, and in your browser, where they draw it. There is no second “client version” of a bug that could drift out of step with the real one.

The server runs the jar at 50 ticks a second. Each tick, for each bug, it:

  1. reads what the bug is trying to do: walk here, turn there, strike;
  2. moves the body and keeps it out of the dirt, the rocks, the sticks and the glass;
  3. asks each leg whether its foot is still somewhere a foot can be, and if not, finds a new foothold and steps to it;
  4. bends every joint of every leg to reach its foot.

That last step is inverse kinematics: given where the foot must go, work out the joint angles that put it there. Each leg is a chain of hinges with real limits. A knee bends one way, and only so far.

Footholds, not animations

A walking bug is a set of feet, each looking for ground. A leg casts rays forward, outward, downward and inward from where it would like to land, and takes the first real surface it finds that its own leg can reach without passing through the bug’s body, another bug, a rock or the glass.

That is why a bug climbs a log without anyone writing “climb log”: its feet find the bark, the body tilts to the plane its planted feet describe, and the next step lands higher. Hanging under a stick, standing on the glass, straddling a boulder: they all come from the same rule.

Legs you can lose

Because a leg is a real chain and not a picture, it can be taken away. Land enough bites on one leg and it comes off, and the bug has one fewer leg to walk on. The gait re-plans around what is left. Down to its last two, a bug crawls on its belly and drags itself.

Every hit lands on real geometry: the tip of a strike against the capsules of the other bug’s body and legs.

120 bytes a bug

The server does not send you the simulation. It sends you its result, 25 times a second:

That is 120 bytes a bug. Your browser puts the skeleton into exactly that pose and skins the mesh over it. The tail, the palps and the eyes that do not change the fight are worked out on your side from the same numbers, the same way the server would.

Bugs that learn

A bug is not a script. Each one carries its own small brain: a set of behaviours with weights that shift after every fight. Behaviours that won it something get tried more; the ones that got it hurt get tried less. Two bugs of the same species, raised differently, fight differently. Controlling your own bug teaches it too: it learns from how you play.

Every fight is kept

Because a fight is just a stream of these small poses, every one is recorded. A replay is the same stream played back, which is why a replay link opens the actual fight and not a video of it.


The devlog is where the hard parts get written up: the bugs that fell off logs, the legs that wouldn’t stay out of the dirt, and how each got fixed.

Fight a bugMore from the devlog