building P2P multiplayer in GDevelop
Small multiplayer games can run smoothly using GDevelop's built-in P2P networking with packet relaying and host authority.
- For small co-op lobbies, running enemy AI logic solely on the host computer and syncing positions to clients minimizes networking overhead
- Clients can store coordinates, state, and animation in a structure variable at 30 ticks per second, convert it to JSON, and relay via the host
- Basic host-side anti-cheat can verify incoming player coordinates against current positions and kick players whose data is anomalous
- Sending a full host-authoritative snapshot packet every 3 to 5 seconds overrides client states to prevent gradual desynchronization
- Small-scale private multiplayer avoids the expensive servers and anti-cheat infrastructure required for competitive MMOs or battle royales


