Tossing a sheep

Sheepdogs is a multiplayer game in your browser. Your cursor is a hand, and you score by bringing sheep into the fold, a round patch of straw in the middle of the field. One way to get a sheep there is to toss it. For two days tossing felt unpredictable, and I wanted to understand why.

Sheepdogs design diary · 3 November 2026 · Play it at sheepdogs.io

Try it below: press on a sheep to pick it up, swing toward the round pen, and let go mid-swing. To set a sheep down, stop moving before you let go. The buttons switch between five ways of turning a swing into a toss, and the text under the field describes the one you pick. Start with “As in the game”.

Pick up a sheep and toss it into the fold

How a swing becomes a toss

When you let go, the game takes the fastest your mouse moved during the last eighth of a second, so you can ease off just before letting go and still toss the sheep. If that speed is over a minimum, the sheep is tossed, further for a faster swing. If it's under the minimum, the sheep is set down.

Five ways side by side

I tested the live game with a program that repeats the same swing, just over the minimum, and one toss in four set the sheep down instead. So I built the field above to compare the game's rule with four that have no minimum. I tried them all and liked the game's own rule best. That surprised me, because on this page it felt graceful, and in the game the same rule felt unpredictable.

The swing arrived in jumps

Both used the same rule, so I compared how each one measured the swing. This page measures it in your browser, from every mouse movement the browser reports. The game measured it on the server, the computer that runs the shared game for everyone in the room. The server only learns where your mouse is when a message from your browser arrives, thirty times a second at best and at uneven intervals. When two messages arrived almost together, the server worked out a speed as if your mouse had covered that distance in almost no time. In eight tests with a slow, steady swing that should set the sheep down, the server tossed the sheep six times.

Now your browser measures the swing and sends the measurement to the server when you let go, and the server applies the rule. In my tests, tosses in the game now match this page to within 0.2 metres a second in speed and one degree in direction.

The moment after you let go

Tossing in the game still looked wrong, so I added a graph of how fast your mouse, the hand and the sheep move around the moment you let go. With the graph, and by playing this page next to the game, I found four problems.

What I learned

My test swings stopped before letting go, so they missed everything that goes wrong when the mouse is still moving. Now I also test letting go at full speed, and I watch the frames right after, as well as checking the numbers.

More from this diary: how herding became drawing, and flowers from a zigzag.