Table of Contents

Interface INetcodeSession<TInput>

Namespace
Backdash
Assembly
Backdash.dll

Contract for managing a netcode session.

public interface INetcodeSession<TInput> : INetcodeSession, INetcodeSessionInfo, IDisposable, IAsyncDisposable where TInput : unmanaged

Type Parameters

TInput

Game input type

Inherited Members

Properties

CurrentInputs

Return all synchronized inputs. This must be called after SynchronizeInputs()

ReadOnlySpan<TInput> CurrentInputs { get; }

Property Value

ReadOnlySpan<TInput>

CurrentSynchronizedInputs

Return all synchronized inputs with connect status. This must be called after SynchronizeInputs()

ReadOnlySpan<SynchronizedInput<TInput>> CurrentSynchronizedInputs { get; }

Property Value

ReadOnlySpan<SynchronizedInput<TInput>>

Random

Deterministic random value generator. Must be called after SynchronizeInputs().

INetcodeRandom Random { get; }

Property Value

INetcodeRandom

Methods

AddLocalInput(NetcodePlayer, in 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 players of type Local.

ResultCode AddLocalInput(NetcodePlayer player, in TInput localInput)

Parameters

player NetcodePlayer

Player owner of the inputs

localInput TInput

The input value

Returns

ResultCode

GetInput(NetcodePlayer)

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

ref readonly SynchronizedInput<TInput> GetInput(NetcodePlayer player)

Parameters

player NetcodePlayer

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>

SetRandomSeed(uint, uint)

Add an extra state seed to calculate the next INetcodeRandom on Random This value state must be deterministic and be called every frame before SynchronizeInputs()

void SetRandomSeed(uint seed, uint extraState = 0)

Parameters

seed uint
extraState uint

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