← Back to the devlog

A Village With One Truth

Two people can stand beside the same gate and see slightly different moments. One has just stepped through it; the other hasn’t received that movement yet. That’s ordinary network delay. The difficult part is making the village feel responsive without letting those two versions of events become two different worlds.

This is the first of two technical posts about Vatra’s networking. It’s an implementation snapshot, not a promise that latency has disappeared.

The church and its neighbours in the current village renderer

An offline scene staged with current game assets. It illustrates the shared world, not a network test.

The server decides what happened

Vatra’s client is Godot with GDScript. Its authoritative simulation is a Rust module running in SpacetimeDB. The client sends intentions: walk in this direction, attack, offer an item. The server validates them and owns the resulting positions, damage, inventory and village state.

That distinction matters even in a cooperative game. A client shouldn’t be able to walk through a wall or create building supplies because its local picture says it can. Gabriel Gambetta’s introduction to authoritative game servers explains the underlying trust boundary; Vatra applies it to a village rather than a competitive arena.

Our GDScript adapter uses the tested v1.json.spacetimedb WebSocket compatibility protocol with the pinned SpacetimeDB 2.10.0 backend. Subscriptions provide an initial state and subsequent row changes. Typed caches turn those rows into gameplay data; UI panels don’t each invent a protocol parser. This is a game-specific adapter, not a claim to implement every SDK feature.

Your feet don’t wait for a round trip

Server authority alone would make walking feel late. We therefore predict the local player’s movement immediately, using the same integer movement rules as the server.

The movement contract uses fixed 50-millisecond steps: 20 simulation ticks per second. Positions are measured in milli-pixels, or thousandths of a world pixel. Collision, sliding and direction limits have matching Rust and GDScript implementations, checked against shared fixtures. Rendering can run faster; it doesn’t change how far an authoritative movement step travels.

Each input step has a sequence number. When the server reports a position and the last sequence it applied, the client:

  1. Starts from that authoritative position.
  2. Discards acknowledged inputs.
  3. Replays the inputs the server hasn’t acknowledged yet.

The result is a prediction of now, not a blind jump back to an older position. Small visual corrections ease in; large discrepancies snap rather than leave the player visibly far from the real world. The unacknowledged queue is bounded, so a stalled connection can’t generate unlimited speculative travel.

This is the pattern described in Gambetta’s client-side prediction and server reconciliation. The fixed-step discipline also has a useful companion in Glenn Fiedler’s Fix Your Timestep!: simulation time and display time solve different problems.

Other players are a different problem

We know your inputs. We don’t know what your friend will press next. Remote players therefore use buffered authoritative positions instead of local input prediction.

Their normal render target sits 100 milliseconds behind our estimated server time. Two samples bracketing that target let the client draw an intermediate position rather than jump from update to update. Remote players clamp to the available samples when the buffer runs short; enemy rendering has a separate bounded extrapolation option.

The trade-off is deliberate: a small display delay buys smoother movement, but does not reveal the future. Gambetta’s entity interpolation article makes that distinction especially clear.

A responsive picture isn’t a confirmed result

The client can anticipate movement and show an action starting. It doesn’t award itself damage, loot or a completed restoration. Those consequences still come from the server. A sword animation and a confirmed hit are different facts.

That’s the central compromise: local responsiveness, shared authority, and explicit correction when they disagree. It isn’t rollback networking or a guarantee of perfect play on every connection. In the next networking post, we’ll look at the less visible half of the job: what happens when a command’s answer never arrives.

In the implementation

  • Server-owned simulation and a tested Godot WebSocket adapter.
  • Shared integer movement rules, sequenced inputs and reconciliation.
  • Buffered remote-player rendering with a 100-millisecond target delay.
  • Server-confirmed combat and economy outcomes, rather than client-owned rewards.