Devlog — making a chain of fish swing

By Jay ·

The moment that sells How to Fish Online is the one right after you reel in: eight fish hanging off your line, swinging and knocking into each other, then bursting out of the water in every direction. Nothing about that moment is animated by hand. It is a physics simulation, and getting it to feel right took more tuning than anything else in the game. This is how it works.

Every fish is a body, every link is a spring

When your hook touches a fish, the game removes the swimming sprite and puts a new one in its place: a circle with its own mass, bounce and air resistance, living in the Matter.js physics world. The circle's radius is the fish's collision radius from the game's data — 10 px for a sardine, 18 px for a pufferfish — so a big fish really does take up more room in the chain.

That fish is then tied to something with a constraint: an invisible spring with a rest length and a stiffness. The first fish is tied to an anchor that follows your hook. Every fish after that is tied to the fish before it, not to the hook. That one decision is where the comedy comes from. Pull the hook sideways and the force travels down the chain one link at a time, so the bottom fish arrives late and overshoots, like the end of a whip.

The chain holds at most eight fish. Past that, the hook is full and you just carry them up.

The first version was a clump

The first constraint settings were a rest length of 26 px and a stiffness of 0.9. On paper that sounds sensible — short, tight links so the chain stays together. In practice the fish piled into a single wobbling lump under the hook. Neighbouring fish overlapped because 26 px is less than the width of two fish side by side, the stiff springs fought each other, and the whole thing jittered instead of swinging.

The fix was four numbers, all still marked as tuning points in the source:

Setting Before Now What it changed
Link length 26 px 36 px Room between fish, so they stop overlapping
Link stiffness 0.9 0.4 Softer springs, so the chain sways instead of shuddering
Air friction default 0.02 A little drag that lets the chain stretch out into a line
Bounce default 0.4 Fish knock into each other without ricocheting forever

The air friction is the subtle one. With almost no drag, a soft chain behaves like a bag of springs and keeps bouncing. A small amount of drag bleeds off that energy, so when you move the hook the chain trails behind it in a line — which is what a real catch on a line looks like.

Making a hit feel like a hit

Physics gives you motion, but motion alone feels floaty. Three small effects make hooking a fish feel solid:

  • Hit-stop. When a fish hooks on, the physics world pauses for 45 milliseconds. You never consciously notice it, but the tiny freeze reads as impact.
  • Camera shake. At the same moment the camera shakes for 70 ms at a very small strength. Big enough to feel, small enough not to blur the screen.
  • A forgiving hitbox. A fish counts as touched when your hook is within its radius plus 10 px. The sprites are drawn slightly wider than their collision circles, so without that margin the hook would visibly pass through a fish and miss. With it, what you see is what you get.

The launch

When the hook breaks the surface, every link is deleted at once and each fish gets its own random throw — a sideways speed anywhere from −4 to 4 and an upward speed between 12 and 17 in the physics engine's units — plus a little spin. That spread is why a chain fans out into the air instead of rising as one block. At the same instant the physics clock drops to 30% speed and eases back to normal over 400 ms. That short slow-motion beat is your window to read where everything is heading before you start shooting.

Once airborne, fish are not all equal. Each species has an "air wobble" value that pushes it sideways in a sine wave while it flies. Sardines and bass have none and fly in clean arcs. Mackerel wobble a little, swordfish more, and pufferfish (wobble 0.8 out of 1) drift around so much that they are the hardest target in the game, despite being the biggest. Anything that falls back below the waterline escapes, so slow shooting costs real money. The fish guide lists every species' behaviour, and the combo and shooting tips cover how to clear a chain before it lands.

Why not just animate it?

A hand-made animation would look the same every time. The physics chain never does: the same eight fish will hang differently depending on the order you hooked them, how fast you were moving and which way you jerked the hook in the last second. That variety is most of the game's replay value, and it costs nothing more than a handful of well-tuned numbers.