unity-multiplayer
Skill4 starsChanged 3 months agoMITView on GitHub
Build Netcode for GameObjects, Relay and Lobby, server authority and lag compensation. For exploit defense, see anti-cheat. Use when implementing Netcode for GameObjects or sync.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Nice-Wolf-Studio/unity-claude-skillstheir own version, first seen Sep 14, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Nice-Wolf-Studio/unity-claude-skills★ 32same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- anti-cheatSkill
- blender-add-on-engineerSkill
- blender-animationSkill
- blender-modelingSkill
- blender-toolingSkill
- game-aiSkill
- game-audio-engineerSkill
- game-audioSkill
- game-build-pipelineSkill
- game-designerSkill
- game-designSkill
- game-ideationSkill
- game-monetization-designerSkill
- game-monetizationSkill
- game-performanceSkill
- game-uiSkill
- game-version-controlSkill
- godot-gameplay-scripterSkill
- godot-multiplayer-engineerSkill
- godot-shader-developerSkill
- level-designerSkill
- level-designSkill
- narrative-designerSkill
- narrative-designSkill
- playtest-feedback-analyzerSkill
- playtestingSkill
- production-planningSkill
- roblox-avatar-creatorSkill
- roblox-experience-designerSkill
- roblox-systems-scripterSkill
- tech-artSkill
- technical-artistSkill
- unity-architectSkill
- unity-architectureSkill
- unity-editor-tool-developerSkill
- unity-multiplayer-engineerSkill
- unity-shader-graph-artistSkill
- unity-shadersSkill
- unity-toolingSkill
- unreal-multiplayer-architectSkill
- unreal-multiplayerSkill
- unreal-systems-engineerSkill
- unreal-systemsSkill
- unreal-tech-artSkill
- unreal-technical-artistSkill
- unreal-world-builderSkill
- unreal-worldsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Use Unity Transport Package (UTP) combined with Unity Relay service to pierce corporate firewalls and symmetric NATs without requiring …
- Very specific: line 46
Use NetworkVariable for persistent state (Health, Gold, Position).
- Very specific: line 47
Use RPCs for transient one-off events (Sound effects, particle spawns).
- Distinctive: line 55
If client position drifts beyond error threshold $\epsilon$, server overwrites client position with authoritative coordinates, and client …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
unity-multiplayer
Core Philosophy
Multiplayer game programming is an exercise in distributed systems operating under the constraints of physics and latency. You cannot trust the client; anything calculated on a player's machine—hit detection, movement speed, inventory transactions—will inevitably be hacked. High-performance Unity multiplayer requires a server-authoritative model with Netcode for GameObjects (NGO), Unity Relay & Lobby for NAT traversal, and client-side prediction with server reconciliation to mask network latency for players.
4-Step Unity Multiplayer Architecture
Step 1: Topology & Transport (NGO + Relay + Lobby)
- Network Topology:
- Dedicated Game Server (DGS): Absolute authority, zero host advantage, highest server cost. Best for competitive matchmaking.
- Listen Server / Host-Client: One player acts as both host and server. Zero server cost, but host has 0ms latency advantage.
- Unity Transport & Relay:
- Use Unity Transport Package (UTP) combined with Unity Relay service to pierce corporate firewalls and symmetric NATs without requiring players to configure router port forwarding.
- Unity Lobby:
- Handles room matchmaking, player slot reservations, and custom lobby metadata before spinning up the network transport.
Step 2: Server Authority & NetworkVariables
NetworkBehaviour& Ownership:- Code checks
IsServer,IsClient, andIsOwner:if (!IsOwner) return; // Only local player handles input
- Code checks
NetworkVariable<T>:- Replicates state from Server $\to$ Clients automatically:
public NetworkVariable<int> Health = new( 100, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Server // Never allow client writes! );
- Replicates state from Server $\to$ Clients automatically:
Step 3: Remote Procedure Calls (RPCs)
- ServerRpc: Client calls, Server executes (e.g. RequestFireWeaponServerRpc).
- ClientRpc: Server calls, all Clients execute (e.g. PlayExplosionFxClientRpc).
- RPC Rule of Thumb:
- Use
NetworkVariablefor persistent state (Health, Gold, Position). - Use
RPCsfor transient one-off events (Sound effects, particle spawns).
- Use
Step 4: Lag Compensation & Client Prediction
- Client-Side Prediction:
- Client immediately applies local input and updates position locally without waiting for server confirmation round-trip.
- Server Reconciliation:
- Server validates movement: $$\Delta \vec{p} \le \vec{v}_{\text{max}} \times \Delta t + \epsilon$$
- If client position drifts beyond error threshold $\epsilon$, server overwrites client position with authoritative coordinates, and client smoothly blends to the corrected position.
- Lag Compensated Hitbox History:
- Server rewinds player hitboxes back in time by the attacker's latency $T_{\text{rtt}} / 2$ to verify if the shot lined up when the client pulled the trigger.
Deliverable Format: Server-Authoritative NGO Weapon Firing Pattern
using Unity.Netcode;
using UnityEngine;
public class NetworkPlayerWeapon : NetworkBehaviour {
[SerializeField] private GameObject bulletPrefab;
[SerializeField] private Transform muzzleTransform;
private void Update() {
if (!IsOwner) return;
if (Input.GetButtonDown("Fire1")) {
// Request firing to the authoritative server
FireWeaponServerRpc(muzzleTransform.position, muzzleTransform.forward);
}
}
[ServerRpc]
private void FireWeaponServerRpc(Vector3 origin, Vector3 direction) {
// Server validation check
if (Vector3.Distance(origin, muzzleTransform.position) > 1.5f) {
Debug.LogWarning($"[Security] Player {OwnerClientId} origin spoofing detected!");
return;
}
// Spawn networked bullet
GameObject bullet = Instantiate(bulletPrefab, origin, Quaternion.LookRotation(direction));
bullet.GetComponent<NetworkObject>().Spawn();
// Notify all clients to play audio/vfx
PlayMuzzleFlashClientRpc();
}
[ClientRpc]
private void PlayMuzzleFlashClientRpc() {
// Play local visual muzzle flash and sound effect
}
}Worked Example: Resolving Rubberbanding in a Fast-Paced Arena Shooter
- Problem: In an action arena shooter built on NGO, players with 120ms ping experienced jarring stutter and teleportation (rubberbanding) whenever sprinting.
- Root Cause: The server was transmitting absolute position snapshots at 20Hz; client prediction was lacking, snapping the local player to historical server coordinates.
- Solution: Implemented tick-based input buffering and reconciliation. Client stores a history buffer of unconfirmed input ticks. When receiving a server correction, the client re-simulates all unacknowledged ticks from the corrected state.
- Result: Movement became completely smooth for players with up to 180ms latency.
Verification Checklist
- All
NetworkVariablewrite permissions set strictly toServer. - Unity Relay service handles NAT punchthrough without manual port forwarding.
- Client movement inputs validated server-side against maximum acceleration limits.
- Weapon hit registration verified on server using historical hitbox rewind.
- Network objects cleanly despawned using
NetworkObject.Despawn()on disconnect.
Anti-Patterns
- Client-Authoritative Damage: Allowing clients to send
DealDamageServerRpc(targetId, 9999)without server-side weapon range, line-of-sight, or ammo validation. - Over-Broadcasting RPCs Every Frame: Sending continuous transform updates via RPCs instead of compressed
NetworkTransformticks. - Ignoring Network Disconnections: Leaving orphaned player GameObjects in the scene when a client forcibly disconnects or loses connection.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

