networking-servers
Multiplayer systems, netcode, game servers, synchronization, and anti-cheat. Build scalable, responsive multiplayer experiences.
What this skill does
# 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
```csharp
// ✅ 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
```csharp
// ✅ 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 Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.