five-on-it / packages/sim/src/proxy
packages/sim/src/proxy
Proxies: a client's prediction world simulates only what it predicts. A twin of a server entity that the player neither controls nor can touch before the next snapshot (the client's Mirror decides) is a proxy: its body is kinematic and stays where its latest snapshot put it, never integrated (no gravity, no solver, no contacts with the level), yet still solid to whatever is simulated (the predicted car, the player's character) and still found by rays; it keeps the collision groups its twin is given, so the proxy of a ghost (griefing.ts) blocks nothing. Being out of reach until the next snapshot, where it goes meanwhile is no concern of the prediction's. The vehicle and character systems pass proxies over (no controller update, no wheel raycasts, no walking, no unstick), a step reads none of them back from Rapier (they do not move), and a resting kinematic body costs the physics step nothing: the cost of a step, and of every replay of a reconciliation, grows with what is simulated, not with how many people and cars the snapshots list. A proxy car looks ahead for nothing (no soft CCD, world.ts): it does not move in the step.
The server never makes a proxy: its worlds, and the determinism gates, run as before.