network-wiredLocalNetworkAuthority

LocalNetworkAuthority

The LocalNetworkAuthority component is a testing stub and single-player fallback that implements all network authority interfaces. It provides immediate approval for all network operations without actual networking.

circle-info

If you're building a single-player only game and never plan to add networking, you can skip the network interfaces entirely. But if your game supports both modes and you have already wired in your Multiplayer solution (NGO, FishNet, etc), LocalNetworkAuthority is the clean way to handle the single-player path without conditional code everywhere.

circle-exclamation

Quick Start

Adding to Your Scene

  1. Select your EnemyMassesCrowdController GameObject

  2. Click Add Component → Search "LocalNetworkAuthority"

  3. Or use the Setup Wizard (it adds this automatically when networking is enabled)

Inspector Settings

Property
Type
Default
Description

Simulate Network Delay

bool

false

Adds artificial latency to mimic real network conditions

Simulated Delay Ms

int

50

Delay in milliseconds (0-500) when simulation is enabled

Enable Debug Logging

bool

false

Logs all network operations to Console

Local Player Id

int

0

Player ID used for ownership tracking


Use Cases

1. Development & Testing

Enable debug logging to see how Enemy Masses makes network calls:

2. Single-Player Mode

Use LocalNetworkAuthority as your default authority for single-player games:

3. Reference Implementation

Study LocalNetworkAuthority to understand how to implement your own authority:


How It Works

Automatic Registration

When LocalNetworkAuthority starts, it automatically registers itself with the NetworkAuthorityProvider:

Immediate Approval

All operations are immediately approved since there's no network validation:

Operation
Behavior

Spawn Requests

Always approved, generates local network IDs

Damage Attempts

Always approved, no rollback possible

Move Commands

Always approved, immediate execution

Attack Commands

Always approved, immediate execution

Network ID Generation

LocalNetworkAuthority generates sequential network IDs starting from 1:


Implemented Interfaces

LocalNetworkAuthority implements INetworkAuthorityExtended, which includes:

Core Interfaces

Interface
Purpose

INetworkAuthority

Base authority (spawn + damage + command)

INetworkSpawnAuthority

Agent spawning and despawning

INetworkDamageAuthority

Damage validation and death tracking

INetworkCommandAuthority

RTS commands (move, attack, stop)

Extended Interfaces (Sub-Authorities)

Interface
Local Implementation

INetworkTransformAuthority

LocalTransformAuthority

INetworkStateAuthority

LocalStateAuthority

INetworkFogAuthority

LocalFogAuthority

INetworkProjectileAuthority

LocalProjectileAuthority


API Reference

Properties

Spawn Methods

Damage Methods

Command Methods

Helper Methods


Simulating Network Conditions

Enable network simulation to test how your game handles latency:

Inspector Setup

  1. Check Simulate Network Delay

  2. Set Simulated Delay Ms (e.g., 100 for 100ms latency)

What Gets Affected

Property
Effect

RoundTripTime

Returns simulatedDelayMs / 1000f

Actual Operations

Not delayed (only RTT property changes)

circle-info

Note: The delay simulation only affects the RoundTripTime property. Actual operations still execute immediately. For true latency testing, use a real network with artificial delay.


Transitioning to Real Multiplayer

When you're ready for actual multiplayer, replace LocalNetworkAuthority with your own implementation:

Step 1: Remove LocalNetworkAuthority

Step 2: Create Your Authority

Step 3: Register Your Authority

Step 4: Handle Client vs Server


Troubleshooting

"Network authority not found" errors

Cause: LocalNetworkAuthority hasn't started yet or was destroyed.

Solution: Ensure LocalNetworkAuthority is on an active GameObject that starts before your spawning code.

Debug logging not showing

Cause: Enable Debug Logging is not checked.

Solution: Enable it in the Inspector.

Network IDs resetting

Cause: LocalNetworkAuthority was destroyed and recreated.

Solution: Keep the authority component persistent, or implement proper ID synchronization.


Best Practices

Practice
Reason

✅ Use for development

Fast iteration without network setup

✅ Use for single-player

Works out of the box

✅ Enable debug logging during development

Understand network call patterns

❌ Don't use for production multiplayer

No actual networking

❌ Don't rely on simulated delay for testing

Doesn't affect actual operations


See Also

  • Network Architecture Overview

  • INetworkAuthority Interfaces

  • Creating a Custom Authority

  • Anti-Cheat System

Last updated