The problem
In a browser game, the server does not see the player press keys. A cheater could simply send “I finished this level in 2 seconds”. A speedrun leaderboard is only worth something if it resists that kind of request, without punishing honest players.
A signed ticket when the run starts
When a signed-in player starts a run, the server records the time and returns a token signed with HMAC, valid for one hour. The server therefore knows how much real time has passed when the run ends: nobody can claim more than that, and a run cannot be submitted twice.
A trace of the run
During the run, the game records a trace: important events (each diamond, key, door), the position of the hero every half second, and the inputs. At the finish, the trace is sent to the server along with the time.
Plausibility checks
A pure function, tested on real recorded runs, then checks the trace against the level:
- Time: the declared time cannot exceed the time measured by the server.
- Collected items: the diamonds, keys and doors must match what is actually in the level, and doors can only open after picking up the right key.
- Positions: the hero must stay inside the level and never be inside a solid tile.
- Speed: the distance between two positions cannot exceed the maximum speed of the hero on each axis, with a 25% margin.
The time kept is the server’s
If the trace passes, the run is consumed exactly once and the stored time is the one computed by the validator, never the number sent by the browser. The same mechanism protects publishing: a level can only be published after its author has finished it in a verified run, tied to the exact content of the level, so any later edit requires a new proof.
The honest limits
This is a plausibility check, not a replay of the run. It stops requests edited by hand: rewritten times, invented diamonds, doors crossed without a key, teleportation. A careful cheater who builds a perfectly coherent fake trace can still get through, and samples taken far apart can hide a jump through a wall one tile thick.
The tolerances are deliberately wide, because it is better to accept a borderline run than to reject a real player. Every new threshold is tested against real recorded runs, including slow ones and runs with pauses. Players can also report a level, and moderators can act on it.
Why not replay every run?
Replaying the run on the server would be stronger, but it requires a perfectly deterministic game engine, where the same inputs always give exactly the same result on every device. It is a possible future step. In the meantime, the current system blocks the easy cheats while keeping the game light and fast.
To learn the speedrun vocabulary, read our platformer glossary; to learn how the game’s graphics are made, read how Bazoocraft draws its pixel art with code.