pluginagentmarketplace

networking-servers

6
0
# Install this skill:
npx skills add pluginagentmarketplace/custom-plugin-game-developer --skill "networking-servers"

Install specific skill from multi-skill repository

# Description

|

# SKILL.md


name: networking-servers
version: "2.0.0"
description: |
Multiplayer systems, netcode, game servers, synchronization, and anti-cheat.
Build scalable, responsive multiplayer experiences.
sasmp_version: "1.3.0"
bonded_agent: 05-networking-multiplayer
bond_type: PRIMARY_BOND

parameters:
- name: architecture
type: string
required: false
validation:
enum: [client_server, p2p, hybrid, dedicated]
- name: framework
type: string
required: false
validation:
enum: [photon, mirror, netcode, fishnet, custom]

retry_policy:
enabled: true
max_attempts: 5
backoff: exponential
jitter: true

observability:
log_events: [start, complete, error, reconnect]
metrics: [latency_ms, packet_loss, bandwidth_kbps, player_count]


Networking & Game Servers

Network Architecture

CLIENT-SERVER (AUTHORITATIVE):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   DEDICATED SERVER                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  β€’ Authoritative game state                          β”‚   β”‚
β”‚  β”‚  β€’ Physics simulation                                β”‚   β”‚
β”‚  β”‚  β€’ Hit validation                                    β”‚   β”‚
β”‚  β”‚  β€’ Anti-cheat checks                                 β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚       ↑↓              ↑↓              ↑↓              ↑↓    β”‚
β”‚   [Client A]    [Client B]    [Client C]    [Client D]     β”‚
β”‚   └─ Prediction  └─ Prediction  └─ Prediction  └─ Predictionβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Netcode Implementation

Client Prediction with Reconciliation

// βœ… Production-Ready: Prediction + Reconciliation System
public class NetworkedMovement : NetworkBehaviour
{
    private struct InputPayload
    {
        public uint Tick;
        public uint Sequence;
        public Vector2 MoveInput;
        public bool Jump;
    }

    private Queue<InputPayload> _pendingInputs = new();
    private CircularBuffer<PlayerState> _stateHistory;
    private uint _inputSequence;

    private void Update()
    {
        if (!IsOwner) return;

        // Capture input
        var input = new InputPayload
        {
            Tick = NetworkManager.ServerTime.Tick,
            Sequence = _inputSequence++,
            MoveInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")),
            Jump = Input.GetButtonDown("Jump")
        };

        // Predict locally (immediate response)
        ApplyInput(input);

        // Store for reconciliation
        _pendingInputs.Enqueue(input);
        _stateHistory.Add(GetCurrentState());

        // Send to server
        SendInputServerRpc(input);
    }

    [ClientRpc]
    private void ReconcileClientRpc(uint ackedSequence, PlayerState serverState)
    {
        if (!IsOwner) return;

        // Remove acknowledged inputs
        while (_pendingInputs.Count > 0 && _pendingInputs.Peek().Sequence <= ackedSequence)
            _pendingInputs.Dequeue();

        // Check for prediction error
        var predictedState = _stateHistory.Get(ackedSequence);
        if (Vector3.Distance(predictedState.Position, serverState.Position) > 0.01f)
        {
            // Reconcile: reset to server state, replay pending inputs
            SetState(serverState);
            foreach (var input in _pendingInputs)
                ApplyInput(input);
        }
    }
}

Lag Compensation

// βœ… Production-Ready: Server-Side Rewind
public class LagCompensation : NetworkBehaviour
{
    private const int HISTORY_SIZE = 128;
    private const float MAX_REWIND_MS = 200f;

    private CircularBuffer<PositionSnapshot>[] _playerHistory;

    [ServerRpc]
    public void RequestHitValidationServerRpc(uint shooterClientId,
        Vector3 shootOrigin, Vector3 shootDirection, uint targetClientId)
    {
        // Get shooter's RTT
        float rtt = NetworkManager.ConnectedClients[shooterClientId].RTT;
        float rewindTime = Mathf.Min(rtt / 2f + 50f, MAX_REWIND_MS);

        // Get target's position at that time
        var targetPastPosition = GetPositionAtTime(targetClientId,
            Time.time - (rewindTime / 1000f));

        // Perform hit check at rewound position
        if (Physics.Raycast(shootOrigin, shootDirection, out var hit))
        {
            if (Vector3.Distance(hit.point, targetPastPosition) < 1f)
            {
                // Valid hit - apply damage
                ApplyDamage(targetClientId, 25);
            }
        }
    }
}

Server Architecture

SCALABLE SERVER ARCHITECTURE:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LOAD BALANCER (Global)                                      β”‚
β”‚         ↓                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  MATCHMAKING SERVICE                                  β”‚   β”‚
β”‚  β”‚  β€’ Player queuing                                     β”‚   β”‚
β”‚  β”‚  β€’ Skill-based matching                               β”‚   β”‚
β”‚  β”‚  β€’ Session creation                                   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚         ↓                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  GAME SERVERS (Auto-scaled)                          β”‚   β”‚
β”‚  β”‚  [US-East] [US-West] [EU] [Asia]                     β”‚   β”‚
β”‚  β”‚  Each region: 10-1000 instances                       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚         ↓                                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  DATABASE CLUSTER                                     β”‚   β”‚
β”‚  β”‚  β€’ Player profiles                                    β”‚   β”‚
β”‚  β”‚  β€’ Match history                                      β”‚   β”‚
β”‚  β”‚  β€’ Leaderboards                                       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Bandwidth Optimization

Technique Savings Implementation
Delta Compression 60-80% Only send changed values
Quantization 50-70% Float β†’ fixed-point
Bit Packing 30-50% Custom serialization
Interest Management 70-90% Only send relevant data
Priority Queue Variable Less important = less often

Anti-Cheat Strategies

ANTI-CHEAT LAYERS:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LAYER 1: Server Authority                                   β”‚
β”‚  β†’ All game state validated on server                       β”‚
β”‚  β†’ Never trust client                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  LAYER 2: Sanity Checks                                      β”‚
β”‚  β†’ Movement speed limits                                    β”‚
β”‚  β†’ Action rate limits                                       β”‚
β”‚  β†’ Position validation                                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  LAYER 3: Statistical Detection                              β”‚
β”‚  β†’ Inhuman accuracy patterns                                β”‚
β”‚  β†’ Impossible reaction times                                β”‚
β”‚  β†’ Abnormal session metrics                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  LAYER 4: Client-Side (Optional)                             β”‚
β”‚  β†’ Memory scanning (EAC, BattlEye)                          β”‚
β”‚  β†’ Process monitoring                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Troubleshooting

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PROBLEM: Players rubber-banding / teleporting               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SOLUTIONS:                                                   β”‚
β”‚ β†’ Increase interpolation buffer                             β”‚
β”‚ β†’ Add jitter buffer for packets                             β”‚
β”‚ β†’ Smooth corrections (lerp, not snap)                       β”‚
β”‚ β†’ Check prediction code determinism                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PROBLEM: Desyncs between clients                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SOLUTIONS:                                                   β”‚
β”‚ β†’ Use fixed-point math                                      β”‚
β”‚ β†’ Sync random seeds                                         β”‚
β”‚ β†’ Periodic full-state resync                                β”‚
β”‚ β†’ State hash comparison                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PROBLEM: High bandwidth usage                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SOLUTIONS:                                                   β”‚
β”‚ β†’ Implement delta compression                               β”‚
β”‚ β†’ Reduce tick rate for non-critical data                    β”‚
β”‚ β†’ Use interest management                                   β”‚
β”‚ β†’ Quantize position/rotation values                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Framework Comparison

Framework Best For Max Players Learning Curve
Photon Quick start 16-32 Easy
Mirror Open source 100+ Medium
Netcode for GO Unity official 100+ Medium
FishNet Performance 200+ Medium
Custom Full control Unlimited Hard

Use this skill: When building multiplayer, designing servers, or implementing anti-cheat.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.