Table of Contents

Interface INetworkBridge

Namespace
Core.Network
Assembly
Core.dll

Bridge interface for network communication. Core defines this interface, Network (or any custom solution) implements it. This allows Core to remain network-agnostic while supporting multiplayer.

Implementations:

  • Archon.Network.NetworkBridge (Unity Transport / Steam)
  • Custom implementations for other networking solutions
  • MockNetworkBridge for testing/replay
public interface INetworkBridge

Properties

IsConnected

Whether we are connected to a multiplayer session. False for single-player.

bool IsConnected { get; }

Property Value

bool

IsHost

Whether we are the authoritative host. Host validates and broadcasts commands. Clients send commands to host for validation.

bool IsHost { get; }

Property Value

bool

Methods

BroadcastChecksum(uint, uint)

Broadcast current state checksum for desync detection.

void BroadcastChecksum(uint tick, uint checksum)

Parameters

tick uint

Game tick this checksum is for

checksum uint

State checksum

BroadcastCommand(byte[], uint)

Broadcast a command to all connected peers. Called by CommandProcessor after executing a command (host only).

void BroadcastCommand(byte[] commandData, uint tick)

Parameters

commandData byte[]

Serialized command data

tick uint

Game tick the command was executed on

SendCommandToHost(byte[], uint)

Send a command to the host for validation. Called by clients when they want to execute a command.

void SendCommandToHost(byte[] commandData, uint tick)

Parameters

commandData byte[]

Serialized command data

tick uint

Game tick the command should execute on

SendStateToPeer(int, byte[], uint)

Send full game state to a specific peer (late join / desync recovery). Host only.

void SendStateToPeer(int peerId, byte[] stateData, uint tick)

Parameters

peerId int

Target peer

stateData byte[]

Serialized game state

tick uint

Current game tick

Events

OnChecksumReceived

Fired when a checksum is received for comparison.

event Action<int, uint, uint> OnChecksumReceived

Event Type

Action<int, uint, uint>

OnCommandReceived

Fired when a command is received from the network. Host: receives commands from clients for validation. Client: receives validated commands from host for execution.

event Action<int, byte[], uint> OnCommandReceived

Event Type

Action<int, byte[], uint>

OnStateReceived

Fired when full state is received (clients only, for late join / desync recovery).

event Action<byte[], uint> OnStateReceived

Event Type

Action<byte[], uint>

OnStateSyncRequested

Fired when a peer requests full state (host only, for late join).

event Action<int> OnStateSyncRequested

Event Type

Action<int>