Multiplayer Sync logo

Multiplayer Sync

Community
jame581
multiplayer-sync

Use when synchronizing multiplayer state — MultiplayerSynchronizer, interpolation, prediction, and lag compensation

Overview

Publisherjame581
RepositoryGodotPrompter
Skill namemultiplayer-sync
Stars
808
Forks
47
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jame581 on GitHub. Read the source before you install it.

Installation

Install the Multiplayer Sync AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jame581/GodotPrompter/tree/master/skills/multiplayer-sync
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jame581/GodotPrompter.git /tmp/GodotPrompter
mkdir -p .claude/skills
cp -r /tmp/GodotPrompter/skills/multiplayer-sync .claude/skills/multiplayer-sync
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Multiplayer Sync in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Multiplayer Sync on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Multiplayer Sync is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Multiplayer Synchronization in Godot 4.3+

All examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.

Related skills: multiplayer-basics for ENet setup, RPCs, and authority model, dedicated-server for headless export and deployment, physics-system for physics interpolation and RigidBody synchronization.


1. MultiplayerSynchronizer

MultiplayerSynchronizer is Godot's built-in node for replicating properties across the network. Add it as a child of the node whose state you want to share.

What It Does

  • Sends property values from the authority peer to all others at a configured interval
  • Supports both delta sync (only changed values) and full sync (all values every tick)
  • Allows visibility filters to control which peers receive updates

Replication Config in the Editor

  1. Select the MultiplayerSynchronizer node in the scene tree.
  2. In the Inspector, open Replication and click Add Property.
  3. Pick the parent node path and property name (e.g. position, velocity).
  4. Set Sync (send every interval) or Spawn (send only on spawn) per property.
  5. Set the Replication Interval (seconds). 0 means every physics frame.

Key Properties

PropertyDescription
replication_intervalSeconds between full sync updates. 0 = every physics frame
delta_intervalSeconds between delta sync updates. 0 = disabled
public_visibilityWhen true, updates go to all peers (default)
visibility_filtersArray of Callables; each returns true if a peer should receive updates

Delta vs Full Sync

ModeHow It WorksBest For
Full syncSends all configured properties every replication_intervalSimple objects, low property count
Delta syncSends only properties that changed since last sync, every delta_intervalObjects with many properties that change infrequently

Use both together: set replication_interval for periodic full state and delta_interval for frequent change-only bursts.

Visibility Filters (GDScript)

gdscript
# Only send updates to peers within 500 units of this object.
func _ready() -> void:
    $MultiplayerSynchronizer.add_visibility_filter(_is_peer_in_range)

func _is_peer_in_range(peer_id: int) -> bool:
    var peer_player := _get_player_node(peer_id)
    if peer_player == null:
        return false
    return global_position.distance_to(peer_player.global_position) <= 500.0

Visibility Filters (C#)

csharp
// Only send updates to peers within 500 units of this object.
public override void _Ready()
{
    var sync = GetNode<MultiplayerSynchronizer>("MultiplayerSynchronizer");
    sync.AddVisibilityFilter(Callable.From<int>(IsPeerInRange));
}

private bool IsPeerInRange(int peerId)
{
    var peerPlayer = GetPlayerNode(peerId);
    if (peerPlayer is null)
        return false;
    return GlobalPosition.DistanceTo(peerPlayer.GlobalPosition) <= 500.0f;
}

2. Property Synchronization

What to Sync

Sync the minimal state needed to reconstruct the visual on remote peers. Typical properties:

PropertyTypeNotes
positionVector2 / Vector3Core transform — sync every frame or use interpolation
velocityVector2 / Vector3Helps remote prediction stay ahead of position snaps
healthint / floatSync reliably on change; delta sync is ideal
animation_stateString / intSync on change; use an enum int to save bandwidth
is_crouchingboolLow-change boolean; delta sync or RPC on change

Synced Player (GDScript)

gdscript
# synced_player.gd
extends CharacterBody2D

## Sync interval in seconds — exposed so designers can tune per object type.
@export var sync_interval: float = 0.05  # 20 Hz

@export var speed: float = 200.0

# These properties are listed in the MultiplayerSynchronizer replication config.
var synced_position: Vector2 = Vector2.ZERO
var synced_velocity: Vector2 = Vector2.ZERO
var synced_health: int = 100
var synced_anim: int = 0  # 0 = idle, 1 = run, 2 = jump

@onready var _sync: MultiplayerSynchronizer = $MultiplayerSynchronizer


func _ready() -> void:
    _sync.replication_interval = sync_interval
    # Only the authority (owner) drives movement.
    set_physics_process(is_multiplayer_authority())


func _physics_process(_delta: float) -> void:
    # Authority: write canonical state so MultiplayerSynchronizer can replicate it.
    synced_position = global_position
    synced_velocity = velocity
    synced_anim     = _compute_anim_state()

Synced Player (C#)

csharp
// SyncedPlayer.cs
using Godot;

public partial class SyncedPlayer : CharacterBody2D
{
    /// <summary>Sync interval in seconds. Exposed so designers can tune per object type.</summary>
    [Export] public float SyncInterval { get; set; } = 0.05f; // 20 Hz

    [Export] public float Speed { get; set; } = 200.0f;

    // These properties are listed in the MultiplayerSynchronizer replication config.
    public Vector2 SyncedPosition { get; set; } = Vector2.Zero;
    public Vector2 SyncedVelocity { get; set; } = Vector2.Zero;
    public int SyncedHealth { get; set; } = 100;
    public int SyncedAnim   { get; set; } = 0; // 0=idle, 1=run, 2=jump

    private MultiplayerSynchronizer _sync = null!;

    public override void _Ready()
    {
        _sync = GetNode<MultiplayerSynchronizer>("MultiplayerSynchronizer");
        _sync.ReplicationInterval = SyncInterval;
        SetPhysicsProcess(IsMultiplayerAuthority());
    }

    public override void _PhysicsProcess(double delta)
    {
        // Authority: write canonical state for replication.
        SyncedPosition = GlobalPosition;
        SyncedVelocity = Velocity;
        SyncedAnim     = ComputeAnimState();
    }

    private int ComputeAnimState()
    {
        if (!IsOnFloor()) return 2;
        return Velocity.Length() > 1f ? 1 : 0;
    }
}

3. Interpolation

MultiplayerSynchronizer updates target properties at sync intervals (e.g., 30 Hz), but rendering runs at frame rate (60+ Hz). Without interpolation, remote players appear to teleport between snapshots. The fix: store position snapshots with timestamps and lerp in _process toward the latest snapshot using a small offset (interpolation buffer ~100 ms).

See references/interpolation.md for the full GDScript and C# interpolation buffer pattern (snapshot ring, latest-snapshot interpolation, render-time lerp).


4. Client-Side Prediction

For local-player responsiveness: predict movement immediately on client, send input to server, reconcile when server snapshot arrives. If server diverges from client prediction beyond a threshold, snap; otherwise smoothly lerp the correction over 100-200 ms.

See references/client-prediction.md for the full predict-and-reconcile pattern (input ring buffer, server reconciliation, replay) in GDScript + C#.


5. Lag Compensation

For hit-scan weapons in fast-paced games: when the server validates a hit, it rewinds the world state to the client's view-time (now - client_rtt/2 - interp_delay) and tests the hit against that historical state.

See references/lag-compensation.md for the snapshot-history pattern, view-time calculation, and a hit-scan validator in GDScript + C#.


6. State vs Input Synchronization

Choose the synchronization model that fits your game's needs:

FactorSync StateSync Inputs
What is sentCurrent property values (position, health, etc.)Player input actions each frame
Who simulatesAuthority only; others receive resultsAll peers run the same simulation
Determinism requiredNoYes — every peer must produce identical output from the same inputs
BandwidthHigher — full state sent each intervalLower — small input structs per frame
ResponsivenessLower — non-authority peers wait for next sync tickHigher — local prediction is trivial when deterministic
ComplexityLower — no reconciliation loopHigher — requires deterministic physics, fixed-point math, or lockstep
Best forAction games, shooters, most real-time gamesFighting games, RTS, turn-based, simulation games
Lag compensation neededYes, for hit detectionUsually not — all peers are in sync

Hybrid approach (most real-time games): sync inputs for the local player's character (enabling prediction), sync state for all other objects and game events.


7. Bandwidth Optimization

Four levers: sync only changed properties (replication-config flag per property), quantize floats (Vector3 components in mm not floats — 16-bit cuts bytes by 2×), distance-based sync rate (far-away objects sync at 5 Hz, close at 30 Hz), and channel selection (reliable for state changes that must arrive, unreliable for position streams that get superseded).

See references/bandwidth-optimization.md for full GDScript + C# recipes for each lever, plus the reliable-vs-unreliable channel decision tree.


8. Implementation Checklist

  • MultiplayerSynchronizer is a direct child of the node it replicates
  • Only the authority peer writes to synced properties; others are read-only
  • set_multiplayer_authority() is called at spawn time with the correct peer ID
  • replication_interval and delta_interval are tuned for the object's update rate
  • Remote player visuals use interpolation in _process, not _physics_process
  • Interpolation stores previous and current state and blends using Engine.get_physics_interpolation_fraction()
  • Client-side prediction is applied only to the local player's own character
  • Pending input buffer is bounded (max ~128 ticks) to prevent memory growth
  • Reconciliation threshold prevents jitter from micro-corrections
  • Position and velocity use unreliable RPC; state changes use reliable
  • Float quantization is applied before sending position data over the network
  • Lag compensation snapshot history is pruned each tick to a bounded window
  • Server validates all hit detection; clients never self-report kills
  • Distance-based sync rate reduces bandwidth for far-away objects

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Multiplayer Sync AI skill do?

Use when synchronizing multiplayer state — MultiplayerSynchronizer, interpolation, prediction, and lag compensation

Why use Multiplayer Sync on TypingMind?

Because you install it once and use it with any model. Multiplayer Sync is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Multiplayer Sync in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jame581/GodotPrompter/tree/master/skills/multiplayer-sync. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Multiplayer Sync?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Multiplayer Sync?

As many as you like. As long as a model supports skills, you can use Multiplayer Sync with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Multiplayer Sync AI skill free?

Yes. It is published on GitHub by jame581 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇