Table of Contents

Interface IRollbackSession<TInput>

Namespace
Backdash
Assembly
Backdash.dll

Context for a multiplayer game session.

public interface IRollbackSession<TInput> : IRollbackSessionInfo, IDisposable where TInput : unmanaged

Type Parameters

TInput

Game input type

Inherited Members

Properties

NumberOfPlayers

Returns the number of player in the current session

int NumberOfPlayers { get; }

Property Value

int

NumberOfSpectators

Returns the number of spectators in the current session

int NumberOfSpectators { get; }

Property Value

int

Random

Deterministic random value generator. This must be called after SynchronizeInputs()

IDeterministicRandom Random { get; }

Property Value

IDeterministicRandom

Methods

AddLocalInput(PlayerHandle, TInput)

Used add local inputs and notify the netcode that they should be transmitted to remote players. This must be called once every frame for all player of type Local.

ResultCode AddLocalInput(PlayerHandle player, TInput localInput)

Parameters

player PlayerHandle

Player owner of the inputs

localInput TInput

The input value

Returns

ResultCode

AdvanceFrame()

Should be called at the end of each frame of your application and also in AdvanceFrame().

void AdvanceFrame()

BeginFrame()

Should be called at the start of each frame of your application

void BeginFrame()

DisconnectPlayer(in PlayerHandle)

Disconnects a remote player from a game.

void DisconnectPlayer(in PlayerHandle player)

Parameters

player PlayerHandle

GetInput(in PlayerHandle)

Returns the value of a synchronized input for the requested player. This must be called after SynchronizeInputs()

ref readonly SynchronizedInput<TInput> GetInput(in PlayerHandle player)

Parameters

player PlayerHandle

Returns

SynchronizedInput<TInput>

GetInput(int)

Returns the value of a synchronized input for the requested player index. This must be called after SynchronizeInputs()

ref readonly SynchronizedInput<TInput> GetInput(int index)

Parameters

index int

Returns

SynchronizedInput<TInput>

GetInputs(Span<SynchronizedInput<TInput>>)

Copy the value of all synchronized inputs into the buffer. This must be called after SynchronizeInputs()

void GetInputs(Span<SynchronizedInput<TInput>> buffer)

Parameters

buffer Span<SynchronizedInput<TInput>>

GetInputs(Span<TInput>)

Copy the value of all synchronized inputs into the buffer. This must be called after SynchronizeInputs()

void GetInputs(Span<TInput> buffer)

Parameters

buffer Span<TInput>

GetNetworkStatus(in PlayerHandle, ref PeerNetworkStats)

Gets statistics and information about a player into info. Returns false if the request player is not connected or synchronized.

bool GetNetworkStatus(in PlayerHandle player, ref PeerNetworkStats info)

Parameters

player PlayerHandle
info PeerNetworkStats

Returns

bool

GetPlayerStatus(in PlayerHandle)

Returns connection status of a player.

PlayerConnectionStatus GetPlayerStatus(in PlayerHandle player)

Parameters

player PlayerHandle

Returns

PlayerConnectionStatus

GetPlayers()

Returns a list of all input players in the session.

IReadOnlyCollection<PlayerHandle> GetPlayers()

Returns

IReadOnlyCollection<PlayerHandle>

GetSpectators()

Returns a list of all spectators in the session.

IReadOnlyCollection<PlayerHandle> GetSpectators()

Returns

IReadOnlyCollection<PlayerHandle>

SetFrameDelay(PlayerHandle, int)

Change the amount of delay frames for local input.

void SetFrameDelay(PlayerHandle player, int delayInFrames)

Parameters

player PlayerHandle
delayInFrames int

SynchronizeInputs()

Synchronizes the inputs of the local and remote players into a local buffer You should call this before every frame of execution, including those frames which happen during rollback.

ResultCode SynchronizeInputs()

Returns

ResultCode