Godot adapt single to multiplayer

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot adapt single to multiplayer is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert patterns for adding multiplayer to single-player games including client-server architecture, authoritative server design, MultiplayerSynchronizer, lag compensation (client prediction, server reconciliation), input buffering, and anti-cheat measures. Use when retrofitting multiplayer, porting

How to use this skill

Skill file

NEVER Do (Expert Multiplayer Rules)

Security & Authority

Movement & Lag

Bandwidth & Sync


Available Scripts

MANDATORY: Architecture decision tree first, then golden-path scripts. Deep latency workflows → CODE0.

Authority / transport bridges

[multiplayer_sync.gd](scripts/multiplayer_sync.gd)

MANDATORY when adding MultiplayerSynchronizer interpolation for remote peers. Trigger: authority owns transforms; non-authority interpolates.

[rpc_bridge.gd](scripts/rpc_bridge.gd)

MANDATORY signal→RPC bridge. Trigger: gameplay emits local signals; bridge validates authority and fans out RPCs.

Prediction / lag / lobby

[net_prediction_reconciliation.gd](scripts/net_prediction_reconciliation.gd)

CharacterBody prediction + input-buffer replay for server reconciliation.

[net_snapshot_interpolation.gd](scripts/net_snapshot_interpolation.gd)

Snapshot interpolation / jitter buffers for remote peers.

[net_auth_server_validator.gd](scripts/net_auth_server_validator.gd)

Authoritative validation (position, speed, actions).

[net_rpc_rate_limiter.gd](scripts/net_rpc_rate_limiter.gd)

RPC flood / macro protection.

[net_interest_management.gd](scripts/net_interest_management.gd)

Distance-based visibility to cut bandwidth.

[net_delta_compression_sync.gd](scripts/net_delta_compression_sync.gd)

Quantization + significance checks for delta sync.

[net_lag_compensation.gd](scripts/net_lag_compensation.gd)

Server-side rewind for hit registration.

[net_lobby_late_join_sync.gd](scripts/net_lobby_late_join_sync.gd)

Late-joiner world snapshot bootstrap.

Diagnostics

[net_latency_simulator.gd](scripts/net_latency_simulator.gd)

MANDATORY before ship — see CODE0.

[net_debug_overlay_monitor.gd](scripts/net_debug_overlay_monitor.gd)

RTT / loss / jitter overlay.

[net_upnp_discovery_logic.gd](scripts/net_upnp_discovery_logic.gd)

UPNP port mapping for listen-server / P2P hosts.


Architecture Patterns

| Pattern | When | Script golden path |

|---------|------|--------------------|

| Authoritative server | PvP, economies, cheat risk | rpc_bridge.gd → net_auth_server_validator.gd → prediction/recon |

| P2P lockstep | 2–4 co-op, low cheat risk | Deterministic inputs + net_upnp_discovery_logic.gd |

| Hybrid / host authority | Party games 4–8 | Host authority + late-join snapshot |


Migration golden path (no inline host/join tutorials)

  1. Separate input (client) from simulation (authority).
  2. Set multiplayer_authority per player node; clients send intents only.
  3. MANDATORY multiplayer_sync.gd for property replication / remote interpolation.
  4. MANDATORY rpc_bridge.gd for gameplay events that cross the wire.
  5. Add prediction / lag compensation scripts only for the genres that need them.
  6. Validate with latency-testing reference + net_latency_simulator.gd at ~150 ms RTT.

Expert insights (WHY — keep in body)

Decision Tree: Which Architecture?

| Factor | Authoritative Server | P2P Lockstep |

|--------|---------------------|--------------|

| Player count | 8-100+ | 2-4 |

| Cheat prevention | Critical | Not important |

| Server hosting | Available | Not available |

| Gameplay type | PvP, competitive | Co-op, casual |

| Lag tolerance | Medium (prediction helps) | Low (desyncs) |

| Development complexity | High | Medium |

Advanced Networking Topics

Peer-to-Peer NAT Traversal (Hole Punching)

In P2P architectures, clients often sit behind firewalls. UPNP (Universal Plug and Play) is the first line of defense, allowing the game to request port forwarding from the router automatically using net_upnp_discovery_logic.gd.

For cases where UPNP fails:

Network Profiling & Visualization

Visualizing the packet timeline is critical for debugging jitter. Propose an overlay that graphs:

Deep recipes (on demand)

| Topic | Reference / script |

|-------|-------------------|

| Prediction / recon / interpolation | prediction-and-reconciliation.md |

| Authority / anti-cheat / bandwidth | authority-and-security.md |

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API;

load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.