5 laps · 26 crashes · 7 km driven
A live destruction derby. Everyone here drives a car in their gallery colour: lap the track, or wreck each other.
What fold does here
The race itself runs in memory, 30 steps a second. What fold keeps is what happened: laps, crashes, wrecks and distance driven, each an event with its time. Every statistic on screen is a view over those events: laps and best lap, distance and top speed, kills and deaths, and a leaderboard ordered by laps, then distance.
Fold refuses impossibly quick laps.
Why it shows off fold
It shows where fold belongs in a real-time app, and where it doesn't. Thirty frames a second of car positions don't need a database; the record of the race does. Each tick's events go to fold in one transaction, the standings update incrementally rather than being re-sorted, and a subscription pushes them to every viewer. It also shows how cheap that is: an in-memory fold commit takes microseconds, so recording a busy race costs almost nothing.
Worth trying
- Drive a lap and watch your best time land on the board.
- Ram someone: the kill and the death are recorded in the same tick.
- Open Inspect to see each tick's events going in.
Still app code
The whole simulation: driving, grip, collisions, damage and checkpoints, stepped on the server and pushed to every browser.
Press \ in the app to watch fold's commits as they happen.