multiplayer-networking
БесплатноБез исполняемых скриптовНе проверенNetcode reference patterns: a model comparison, a common mistakes catalog (rubber-banding, desync, bandwidth), delta encoding and quantization, reconciliation…
от HermeticOrmus★ 83 звезды на GitHubОб этом скилле
Multiplayer networking pattern library
Reference patterns for game multiplayer netcode.
Netcode model comparison
| Model | Best for | Latency tolerance | Bandwidth | Determinism required |
|---|---|---|---|---|
| Rollback | Fighting games | Very tight | Low | Yes |
| Lockstep | RTS, lockstep RTS | Tolerant | Very low | Yes |
| Client prediction + reconciliation | FPS, MOBA, action | Medium | Medium | No |
| Server-authoritative + interpolation | Racing, MMO movement | Tolerant | Medium-high | No |
| Pure state snapshots | Slow-paced games | Very tolerant | High | No |
Common mistakes catalog
"Rubber-banding when player runs forward"
The player's client predicts forward motion. Server agrees and confirms. No rubber-band. Then player turns; client predicts turn; server says "no, you didn't turn yet" because the turn input hadn't reached the server when the server's last tick fired. Server position is one tick behind; client snaps back.
Fix: smooth reconciliation. When server position differs from predicted, interpolate over 100-200ms rather than snapping.
"I shot them dead-on and missed"
Favor-the-target policy. Server's "current" state is what counts; if your shot took 50ms to reach the server, the target may have moved. Either:
- Switch to favor-the-shooter (lag compensation)
- Use projectile weapons (the projectile travels in server time, no compensation needed)
"I was shot around a corner"
Favor-the-shooter policy working as intended. The shooter saw you at their lag-compensated time; you've since moved behind cover. You're dead on the server before you visually see the threat.
Mitigation: limit lag compensation window (e.g., 100ms max, not 250ms).
"Multiplayer works in lab, breaks on mobile data"
Mobile cellular has higher jitter and occasional packet loss. Check:
- Tick rate too high for cellular bandwidth budget
- No packet loss tolerance (UDP without reliability layer)
- No connection migration on IP change (mobile data → WiFi)
- Power-save modes throttling background packets
"Desync after 30 seconds in lockstep RTS"
Nondeterminism. Audit:
- Float math anywhere in game state → switch to fixed-point
- RNG → seed at game start, use same RNG instance for all clients
- Iteration order over collections → use ordered collections (List, sorted Dictionary)
- Time-based logic → use tick count, not wall clock
- Third-party libraries → check determinism guarantees
"Bandwidth balloons at high player counts"
Need interest management:
- Don't replicate everyone to everyone
- Each client subscribes to entities within its area of interest (visible + nearby)
- Cell-based partitioning or proximity-based subscription
"Rollback budget exceeded constantly"
Either:
- RTT too high for the chosen input delay; increase input delay
- State serialization is too slow; profile + optimize
- Game state contains nondeterministic elements making rollback impossible
"Players desync on resume from sleep / app backgrounding"
Game logic kept advancing while suspended (timer-based), or stopped while suspended (frame-based). Either way, syncing the resumed client requires state download from server.
Pattern: on resume, request full state from server before resuming play.
Bandwidth optimization patterns
Delta encoding
Frame N state: position = (100, 50, 200), rotation = 45deg, hp = 80
Frame N+1 state: position = (101, 50, 200), rotation = 45deg, hp = 80
Naive send: position + rotation + hp = ~16 bytes
Delta send: position.x changed = 4-byte field + 4-byte value = 8 bytes
Savings: ~50%. Compounds with quantization.
Quantization
- Position: from 32-bit float to 16-bit fixed-point (sub-mm precision over 1km range): 50% size reduction
- Rotation: from quaternion to compressed quaternion (smallest 3 + sign bit): 4 bytes → ~1.4 bytes
- Velocity: 8-bit per axis when bounded: 32 bytes → 3 bytes
- Time stamps: relative to a known epoch, 16-bit fits ~64 seconds at 1ms precision
Bit packing
Boolean state flags: is_jumping, is_attacking, is_grounded, is_alive
Naive: 4 bytes (one per bool)
Packed: 1 byte (4 bits used, 4 bits header)
State enum (8 states): 1 byte → 3 bits
Priority queues
When bandwidth budget is tight:
Priorities:
Critical (must arrive every tick): player position, HP
High (every 2-3 ticks): held weapon, ammo
Medium (every 5-10 ticks): outfit, secondary stats
Low (every ~100 ticks): emote, name, distant NPCs
Bandwidth-constrained: send only critical + as much high/medium as fits in budget
Reconciliation smoothing
private const float SMOOTHING_TIME = 0.15f; // 150ms
private Vector3 _renderOffset = Vector3.zero;
private void OnReconcile(Vector3 serverPosition)
{
// Don't snap to serverPosition. Save the offset.
_renderOffset = transform.position - serverPosition;
transform.position = serverPosition;
}
private void LateUpdate()
{
// Decay the offset over SMOO
Установить multiplayer-networking в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл multiplayer-networking?
Netcode reference patterns: a model comparison, a common mistakes catalog (rubber-banding, desync, bandwidth), delta encoding and quantization, reconciliation smoothing, a Unity library comparison, NAT traversal, and Godot MultiplayerSynchronizer, prediction, interpolation, and ENet setup. Use when writing or debugging networked game code.
Как установить скилл multiplayer-networking?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл multiplayer-networking запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic