Chapter 29 · shared space
Somebody else was here
A flocking field you can add to with a click — and a ghosts mode that replays deterministic, inline traces of visitors who were here before you. They are simulated. The caption says so, because a demo that let you believe they were real would be a lie with a very good budget.
How it works
What the ghosts are, and are not
A flocking field you can add to with a click — and a ghosts mode that replays deterministic, inline traces of visitors who were here before you. They are simulated. The caption says so, because a demo that let you believe they were real would be a lie with a very good budget.
The agents are a real flocking simulation: separation, alignment and cohesion, integrated per frame, with a spatial hash so neighbour queries stay cheap as the population grows. Click anywhere on the field and you add a body at that point; it immediately starts behaving like everything else, which is the correct way to demonstrate that a visitor joins a system rather than triggering an effect.
The ghosts are the honest part. They are a table of traces generated inline from a fixed seed, so the page is offline, has no dependencies, and produces the same ghosts every time it is opened. Each one is a plausible path — enter, drift, pause, leave — and the whole set is reported in the dock as a count of traces rather than dressed up as a headcount of visitors.
What a real shared space needs
The honest version of this specimen is a mock, and the useful thing a client is buying is the difference between the two. Everything the ghosts fake here is a real engineering problem the real thing has to solve:
- PresenceWho is here. A WebSocket room, a session id, a heartbeat and a timeout, so an abandoned tab leaves the room rather than standing in it forever.
- AuthorityWhose simulation is the real one. Either one client is elected host and the rest are views of its state, or the simulation runs on the server and every client is a renderer.
- ReconciliationNetworks reorder, drop and duplicate. A client that has not been patched for two seconds is not slightly wrong, it is somewhere else, and the page has to be able to say so honestly.
- ScaleA flock is cheap per body and expensive per pair. The spatial hash here is what makes two hundred agents viable; the same approach does not survive ten thousand without a different plan.
- PrivacyPresence is a record of where people were and when. It needs a stated retention policy, and it needs the visitor to be able to see it and leave.
The performance note
Frame time is reported, not promised. The reading in the dock is a real rolling measurement, and under a software rasteriser it will be low — which is the truth about a canvas page rather than a defect in it. The simulation runs in typed arrays and is uploaded once per frame; the per-pair work is bounded by the hash grid rather than by the population.
Under reduced motion, nothing loops. The field is composed once at rest: the agents are placed, the ghosts are drawn as their full traces rather than as moving marks, and the simulation is not stepped. A reader who asks for stillness gets a still crowd, not an empty one.
- Technique
- Shared-space simulation · boid flocking · spatial hash · deterministic trace replay
- What it does
- Lets a visitor join a living system with one click, and shows what other presence looks like without pretending anyone is connected
- Live demo
- The field above — click to add, and toggle the ghosts
- Good for
- Events · exhibitions · community spaces · brand activations · installation work
- Combines with
- WebSockets · 3D · particles · presence · scroll choreography
- Complexity
- High — the simulation is the easy half and the networking is the half that is actually hard
- Performance
- CPU flocking, one canvas. Degrades to a composed static crowd under
prefers-reduced-motion