Skip to content

Networking

aernw edited this page Dec 16, 2025 · 1 revision

Networking

Two-phase networking model:

  1. Lobby Phase (TCP)

    • LobbyServer manages joins/ready/kick via JSON (ASIO).
    • Once minimum players ready, server dispatches UDP session info.
  2. Game Phase (UDP)

    • GameServer runs authoritative simulation.
    • Custom binary protocol (Serializer/Deserializer) keeps clients in sync.
    • Client-side prediction with reconciliation.

Key Files

  • libs/network/include/LobbyServer.hpp
  • libs/network/include/GameServer.hpp
  • libs/network/include/Protocol.hpp

Workflow

flowchart LR
    Client -- TCP --> LobbyServer
    LobbyServer -- start command --> GameServer
    Client -- UDP --> GameServer
Loading

Combine this with Client & Server Flow for the gameplay lifecycle.

Clone this wiki locally