Network Optimization

Download

Unity Cheat Sheet: #36

Abhishek Smith

Abhishek Smith

Building Outscal | Land Jobs in the gaming industry | EA, Epic Games, TCS, | CMU, IIT K

Network optimization in Unity determines if your multiplayer game runs smoothly or becomes unplayable.

Let's break down the critical systems:


Tick Rate & Timing

  • NetworkConfig.TickRate: How often server updates (30-60)
  • ServerTime vs LocalTime: Sync game state
  • TimeTicksPerSecond: Fine-tune network updates

Latency Handling

  • NetworkTransform.Interpolate: Smooth movement
  • TeleportThreshold: Handle lag spikes
  • InterpolationDelay: Buffer for smoother sync
  • SynchronizePhysics: Keep physics in sync

Bandwidth Management

  • EnableNetworkVariableCompression: Reduce data size
  • MaxReceiveEventsPerTickRate: Limit incoming packets
  • MaxSendQueuesPerTickRate: Control outgoing data
  • EnsureMessageOrder: Trade consistency for speed

Connection Management

  • ConnectionApproval: Control who joins
  • MaxConnections: Limit player count
  • ReceiveTimeoutMS: Disconnect handling
  • OnClientDisconnectCallback: Auto-reconnection

RPCs (Remote Procedure Calls)

  • ServerRpc: Client-to-server commands
  • ClientRpc: Server-to-client updates
  • RequireOwnership: Security control

Critical Optimization Tips:

  • Lower tick rates for less critical updates
  • Use unreliable transport for position updates
  • Enable compression for bandwidth savings
  • Implement client-side prediction
  • Handle disconnections gracefully

Show More