Skip to main content

VIVIA — Multiplayer Networking (DESIGN, NOT SHIPPED)

⚠️ Status: designed, not implemented. Nothing in this document exists in the current build — there is no networking code in the repository yet. This page publishes the protocol design so it can be reviewed before implementation. Single-player is fully functional today.

Design Goals​

  • Authoritative server in Rust (tokio) — clients never mutate world state directly
  • TCP with bincode serialization, fixed 20 Hz tick for entity sync
  • Anti-cheat from day one — server validates every packet against world state

Protocol Sketch​

Client → Server​

PacketDescription
JoinPlayer name, handshake, protocol version
PlayerInputPosition, yaw, flying, sprinting (validated server-side)
BlockBreakBlock coordinates (checked against reach + hardness)
BlockPlaceBlock coordinates + type (inventory validated)
AttackMelee reach distance
ChatMessage text
RequestChunksChunk coordinate list (rate-limited)
PingRTTTimestamp for RTT measurement

Server → Client​

PacketDescription
WelcomePlayer ID, spawn point, seed, tick rate
ChunkDataCompressed chunk (16×512×16)
EntitySnapshotCreature + player states at tick
BlockUpdateSingle-block delta
ChatRelayChat messages
KickReason string

Anti-Cheat Validation Plan​

  • Coordinate bombs — reject positions beyond plausible movement per tick
  • NaN positions — reject any non-finite coordinate
  • Rate limiting — per-packet-type budgets (chunk requests especially)
  • Handshake timeouts — drop clients that never complete Join
  • Server-side reach checks — block interactions beyond reach are rejected

Client-Side Interpolation Plan​

Remote players get buffered snapshots (100 ms buffer) and interpolate between the two most recent — the same approach used by Quake 3 source and modern shooters.

Why publish a design before the code exists?​

Because the protocol is the contract. Feedback on tick rate, compression and anti-cheat windows is cheap now and expensive after implementation. If you have opinions — the repo has discussions open.