Table of Contents

Interface INetcodeSessionHandler

Namespace
Backdash
Assembly
Backdash.dll

Defines the callback functions that your application must implement. Backdash will periodically call these functions during the game.

public interface INetcodeSessionHandler

Methods

AdvanceFrame()

Called during a rollback after LoadState(in Frame, ref readonly BinaryBufferReader). You should advance your game state by exactly one frame. Before each frame, call SynchronizeInputs() to retrieve the inputs you should use for that frame. After each frame, you should call AdvanceFrame() to notify Backdash that you're finished.

void AdvanceFrame()

GetStateString(in Frame, ref readonly BinaryBufferReader)

string GetStateString(in Frame frame, ref readonly BinaryBufferReader reader)

Parameters

frame Frame
reader BinaryBufferReader

Returns

string

LoadState(in Frame, ref readonly BinaryBufferReader)

Backdash will call this function at the beginning of a rollback. Binary reader for the state.

void LoadState(in Frame frame, ref readonly BinaryBufferReader reader)

Parameters

frame Frame

The loading frame

reader BinaryBufferReader

Binary state reader

OnPeerEvent(PlayerHandle, PeerEventInfo)

Notification that some PeerEvent has happened for a PlayerHandle

void OnPeerEvent(PlayerHandle player, PeerEventInfo evt)

Parameters

player PlayerHandle

The player owner of the event

evt PeerEventInfo

Event data

OnSessionClose()

Called at the end of a game session, before release resources.

void OnSessionClose()

OnSessionStart()

Called at start of a game session, when all the clients have synchronized. You may begin sending inputs with.

void OnSessionStart()

SaveState(in Frame, ref readonly BinaryBufferWriter)

The client should copy the entire contents of the current game state using writer.

void SaveState(in Frame frame, ref readonly BinaryBufferWriter writer)

Parameters

frame Frame

The frame which the save occurs.

writer BinaryBufferWriter

Binary state writer.

TimeSync(FrameSpan)

The time synchronization has determined that this client is too far ahead of the other one and should slow down to ensure fairness.

void TimeSync(FrameSpan framesAhead)

Parameters

framesAhead FrameSpan

Indicates how many frames the client is ahead