Table of Contents

Class NetcodeSessionBuilder<TInput>

Namespace
Backdash
Assembly
Backdash.dll
public sealed class NetcodeSessionBuilder<TInput> where TInput : unmanaged

Type Parameters

TInput
Inheritance
NetcodeSessionBuilder<TInput>
Inherited Members

Methods

AddJob(INetcodeJob)

Add new custom job

public NetcodeSessionBuilder<TInput> AddJob(INetcodeJob job)

Parameters

job INetcodeJob

Returns

NetcodeSessionBuilder<TInput>

AddJob<TPlugin>()

Add new custom job

public NetcodeSessionBuilder<TInput> AddJob<TPlugin>() where TPlugin : INetcodeJob, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

TPlugin
See Also

Build()

public INetcodeSession<TInput> Build()

Returns

INetcodeSession<TInput>

Configure(Action<NetcodeOptions>)

Configure INetcodeSession<TInput> options

public NetcodeSessionBuilder<TInput> Configure(Action<NetcodeOptions> config)

Parameters

config Action<NetcodeOptions>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureLogger(Action<LoggerOptions>)

Configure session logger

public NetcodeSessionBuilder<TInput> ConfigureLogger(Action<LoggerOptions> config)

Parameters

config Action<LoggerOptions>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureProtocol(Action<ProtocolOptions>)

Configure session protocol

public NetcodeSessionBuilder<TInput> ConfigureProtocol(Action<ProtocolOptions> config)

Parameters

config Action<ProtocolOptions>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureReplay(Action<SessionReplayOptions<TInput>>?)

Configure replay session options.

public NetcodeSessionBuilder<TInput> ConfigureReplay(Action<SessionReplayOptions<TInput>>? config = null)

Parameters

config Action<SessionReplayOptions<TInput>>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureServices(Action<ServicesConfig<TInput>>)

Configure custom session services

public NetcodeSessionBuilder<TInput> ConfigureServices(Action<ServicesConfig<TInput>> config)

Parameters

config Action<ServicesConfig<TInput>>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureSpectator(Action<SpectatorOptions>?)

Configure spectator session options.

public NetcodeSessionBuilder<TInput> ConfigureSpectator(Action<SpectatorOptions>? config = null)

Parameters

config Action<SpectatorOptions>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureSyncTest(Action<SyncTestOptions<TInput>>?)

Configure sync test session options.

public NetcodeSessionBuilder<TInput> ConfigureSyncTest(Action<SyncTestOptions<TInput>>? config = null)

Parameters

config Action<SyncTestOptions<TInput>>

Returns

NetcodeSessionBuilder<TInput>
See Also

ConfigureTimeSync(Action<TimeSyncOptions>)

Configure session time synchronization

public NetcodeSessionBuilder<TInput> ConfigureTimeSync(Action<TimeSyncOptions> config)

Parameters

config Action<TimeSyncOptions>

Returns

NetcodeSessionBuilder<TInput>
See Also

ForLocal()

Set the SessionMode as Local.

public NetcodeSessionBuilder<TInput> ForLocal()

Returns

NetcodeSessionBuilder<TInput>

ForRemote()

Set the SessionMode as Remote.

public NetcodeSessionBuilder<TInput> ForRemote()

Returns

NetcodeSessionBuilder<TInput>

ForReplay(Action<SessionReplayOptions<TInput>>?)

Set the SessionMode as Replay.

public NetcodeSessionBuilder<TInput> ForReplay(Action<SessionReplayOptions<TInput>>? config = null)

Parameters

config Action<SessionReplayOptions<TInput>>

Returns

NetcodeSessionBuilder<TInput>

ForSpectator(Action<SpectatorOptions>?)

Set the SessionMode as Spectator.

public NetcodeSessionBuilder<TInput> ForSpectator(Action<SpectatorOptions>? config = null)

Parameters

config Action<SpectatorOptions>

Returns

NetcodeSessionBuilder<TInput>

ForSpectator(int)

Set the SessionMode as Spectator at localhost.

public NetcodeSessionBuilder<TInput> ForSpectator(int hostPort)

Parameters

hostPort int

Returns

NetcodeSessionBuilder<TInput>

ForSpectator(EndPoint)

Set the SessionMode as Spectator.

public NetcodeSessionBuilder<TInput> ForSpectator(EndPoint hostEndpoint)

Parameters

hostEndpoint EndPoint

Returns

NetcodeSessionBuilder<TInput>

ForSpectator(IPAddress, int)

Set the SessionMode as Spectator.

public NetcodeSessionBuilder<TInput> ForSpectator(IPAddress hostAddress, int hostPort)

Parameters

hostAddress IPAddress
hostPort int

Returns

NetcodeSessionBuilder<TInput>

ForSyncTest(Action<SyncTestOptions<TInput>>?)

Set the SessionMode as SyncTest.

public NetcodeSessionBuilder<TInput> ForSyncTest(Action<SyncTestOptions<TInput>>? config = null)

Parameters

config Action<SyncTestOptions<TInput>>

Returns

NetcodeSessionBuilder<TInput>

UseBackgroundThread(bool)

Run jobs in a separated thread.

public NetcodeSessionBuilder<TInput> UseBackgroundThread(bool enabled = true)

Parameters

enabled bool

Returns

NetcodeSessionBuilder<TInput>

Defaults to true

UsePlugin(INetcodePlugin)

Add plugin type

public NetcodeSessionBuilder<TInput> UsePlugin(INetcodePlugin plugin)

Parameters

plugin INetcodePlugin

Returns

NetcodeSessionBuilder<TInput>
See Also

UsePlugin<TPlugin>()

Use plugin type

public NetcodeSessionBuilder<TInput> UsePlugin<TPlugin>() where TPlugin : INetcodePlugin, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

TPlugin
See Also

WithChecksumProvider(ChecksumDelegate)

public NetcodeSessionBuilder<TInput> WithChecksumProvider(ChecksumDelegate compute)

Parameters

compute ChecksumDelegate

Returns

NetcodeSessionBuilder<TInput>

WithChecksumProvider(IChecksumProvider)

public NetcodeSessionBuilder<TInput> WithChecksumProvider(IChecksumProvider provider)

Parameters

provider IChecksumProvider

Returns

NetcodeSessionBuilder<TInput>

WithChecksumProvider<T>()

public NetcodeSessionBuilder<TInput> WithChecksumProvider<T>() where T : IChecksumProvider, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T

WithComparer(EqualityComparer<TInput>)

Set the TInput comparer.

public NetcodeSessionBuilder<TInput> WithComparer(EqualityComparer<TInput> comparer)

Parameters

comparer EqualityComparer<TInput>

Returns

NetcodeSessionBuilder<TInput>

WithComparer<T>()

Set the TInput comparer.

public NetcodeSessionBuilder<TInput> WithComparer<T>() where T : EqualityComparer<TInput>, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T

WithDeterministicRandom(IDeterministicRandom<TInput>)

public NetcodeSessionBuilder<TInput> WithDeterministicRandom(IDeterministicRandom<TInput> writer)

Parameters

writer IDeterministicRandom<TInput>

Returns

NetcodeSessionBuilder<TInput>

WithDeterministicRandom<T>()

public NetcodeSessionBuilder<TInput> WithDeterministicRandom<T>() where T : IDeterministicRandom<TInput>, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T
See Also

WithEndianness(Endianness)

Select the input serialization Endianness

public NetcodeSessionBuilder<TInput> WithEndianness(Endianness endianness)

Parameters

endianness Endianness

Returns

NetcodeSessionBuilder<TInput>

Defaults to BigEndian

See Also

WithFileLogWriter(string?, bool)

Set the logger LogWriter

public NetcodeSessionBuilder<TInput> WithFileLogWriter(string? filename = null, bool append = true)

Parameters

filename string
append bool

Returns

NetcodeSessionBuilder<TInput>
See Also

WithFrameRate(int)

Base frame rate used to estimate fairness (frame advantage) over peers.

Default FPS(frames per second) 60

public NetcodeSessionBuilder<TInput> WithFrameRate(int fps)

Parameters

fps int

Returns

NetcodeSessionBuilder<TInput>
See Also

WithHandler(INetcodeSessionHandler)

Set the session handler for the INetcodeSession<TInput>

public NetcodeSessionBuilder<TInput> WithHandler(INetcodeSessionHandler handler)

Parameters

handler INetcodeSessionHandler

Returns

NetcodeSessionBuilder<TInput>
See Also

WithInputDelayFrames(int)

Amount of frames to delay local input.

public NetcodeSessionBuilder<TInput> WithInputDelayFrames(int frames)

Parameters

frames int

Returns

NetcodeSessionBuilder<TInput>

Defaults to 2

WithInputListener(IInputListener<TInput>)

Set the logger InputListener

public NetcodeSessionBuilder<TInput> WithInputListener(IInputListener<TInput> listener)

Parameters

listener IInputListener<TInput>

Returns

NetcodeSessionBuilder<TInput>
See Also

WithInputListener<T>()

Set the logger InputListener

public NetcodeSessionBuilder<TInput> WithInputListener<T>() where T : IInputListener<TInput>, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T
See Also

WithLogLevel(LogLevel, bool)

Sets Logger log level

public NetcodeSessionBuilder<TInput> WithLogLevel(LogLevel level, bool appendLevel = true)

Parameters

level LogLevel
appendLevel bool

Returns

NetcodeSessionBuilder<TInput>
See Also

WithLogWriter(ILogWriter)

Set the logger LogWriter

public NetcodeSessionBuilder<TInput> WithLogWriter(ILogWriter writer)

Parameters

writer ILogWriter

Returns

NetcodeSessionBuilder<TInput>
See Also

WithLogWriter(Action<LogLevel, string>)

Set the logger LogWriter

public NetcodeSessionBuilder<TInput> WithLogWriter(Action<LogLevel, string> logAction)

Parameters

logAction Action<LogLevel, string>

Returns

NetcodeSessionBuilder<TInput>
See Also

WithLogWriter<T>()

Set the logger LogWriter

public NetcodeSessionBuilder<TInput> WithLogWriter<T>() where T : ILogWriter, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T
See Also

WithMode(SessionMode)

Set the SessionMode for the INetcodeSession<TInput> to be build.

public NetcodeSessionBuilder<TInput> WithMode(SessionMode mode)

Parameters

mode SessionMode

Returns

NetcodeSessionBuilder<TInput>

Defaults to Remote

WithNetworkEndianness(bool)

If useNetworkEndianness is true, sets the input serialization Endianness to BigEndian

public NetcodeSessionBuilder<TInput> WithNetworkEndianness(bool useNetworkEndianness = true)

Parameters

useNetworkEndianness bool

Returns

NetcodeSessionBuilder<TInput>
See Also

WithOptions(NetcodeOptions)

public NetcodeSessionBuilder<TInput> WithOptions(NetcodeOptions options)

Parameters

options NetcodeOptions

Returns

NetcodeSessionBuilder<TInput>
See Also

WithPackageStats(bool)

public NetcodeSessionBuilder<TInput> WithPackageStats(bool enabled = true)

Parameters

enabled bool

Returns

NetcodeSessionBuilder<TInput>

WithPlayerCount(int)

Sets the number of players for the INetcodeSession<TInput>

public NetcodeSessionBuilder<TInput> WithPlayerCount(int count)

Parameters

count int

Returns

NetcodeSessionBuilder<TInput>

Defaults to 2

WithPlayerStats(bool)

public NetcodeSessionBuilder<TInput> WithPlayerStats(bool enabled = true)

Parameters

enabled bool

Returns

NetcodeSessionBuilder<TInput>
See Also

WithPlayers(params NetcodePlayer[])

Set the players for the INetcodeSession<TInput>

public NetcodeSessionBuilder<TInput> WithPlayers(params NetcodePlayer[] players)

Parameters

players NetcodePlayer[]

Returns

NetcodeSessionBuilder<TInput>

WithPlayers(IEnumerable<NetcodePlayer>)

Set the players for the INetcodeSession<TInput>

public NetcodeSessionBuilder<TInput> WithPlayers(IEnumerable<NetcodePlayer> players)

Parameters

players IEnumerable<NetcodePlayer>

Returns

NetcodeSessionBuilder<TInput>

WithPort(int)

Local Port for UDP connections

public NetcodeSessionBuilder<TInput> WithPort(int port)

Parameters

port int

Returns

NetcodeSessionBuilder<TInput>

Defaults to random port

See Also

WithReplayTestOptions(SessionReplayOptions<TInput>)

Set replay session options.

public NetcodeSessionBuilder<TInput> WithReplayTestOptions(SessionReplayOptions<TInput> options)

Parameters

options SessionReplayOptions<TInput>

Returns

NetcodeSessionBuilder<TInput>
See Also

WithRollbackCounterSmooth(float)

Sets the update factor RollbackFramesSmoothFactor for RollbackFrames.

public NetcodeSessionBuilder<TInput> WithRollbackCounterSmooth(float factor)

Parameters

factor float

Returns

NetcodeSessionBuilder<TInput>

WithSaveStateCount(int)

Value to override the total number of SavedFrame in state store.

public NetcodeSessionBuilder<TInput> WithSaveStateCount(int count)

Parameters

count int

Returns

NetcodeSessionBuilder<TInput>

Defaults to PredictionFrames + PredictionFramesOffset

See Also

WithServices(ServicesConfig<TInput>)

Set custom session services

public NetcodeSessionBuilder<TInput> WithServices(ServicesConfig<TInput> services)

Parameters

services ServicesConfig<TInput>

Returns

NetcodeSessionBuilder<TInput>
See Also

WithSocketFactory(IPeerSocketFactory)

public NetcodeSessionBuilder<TInput> WithSocketFactory(IPeerSocketFactory factory)

Parameters

factory IPeerSocketFactory

Returns

NetcodeSessionBuilder<TInput>

WithSocketFactory(Func<int, NetcodeOptions, IPeerSocket>)

public NetcodeSessionBuilder<TInput> WithSocketFactory(Func<int, NetcodeOptions, IPeerSocket> factory)

Parameters

factory Func<int, NetcodeOptions, IPeerSocket>

Returns

NetcodeSessionBuilder<TInput>

WithSocketFactory<T>()

public NetcodeSessionBuilder<TInput> WithSocketFactory<T>() where T : IPeerSocketFactory, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T

WithSpectatorOptions(SpectatorOptions)

Set spectator session options.

public NetcodeSessionBuilder<TInput> WithSpectatorOptions(SpectatorOptions options)

Parameters

options SpectatorOptions

Returns

NetcodeSessionBuilder<TInput>
See Also

WithStateSizeHint(int)

Size hint in bytes for state serialization pre-allocation.

public NetcodeSessionBuilder<TInput> WithStateSizeHint(int byteSize)

Parameters

byteSize int

Returns

NetcodeSessionBuilder<TInput>

Defaults to 512 bytes

WithStateStore(IStateStore)

Set the StateStore

public NetcodeSessionBuilder<TInput> WithStateStore(IStateStore writer)

Parameters

writer IStateStore

Returns

NetcodeSessionBuilder<TInput>

WithStateStore<T>()

Set the StateStore

public NetcodeSessionBuilder<TInput> WithStateStore<T>() where T : IStateStore, new()

Returns

NetcodeSessionBuilder<TInput>

Type Parameters

T

WithSyncTestOptions(SyncTestOptions<TInput>)

Set sync test session options.

public NetcodeSessionBuilder<TInput> WithSyncTestOptions(SyncTestOptions<TInput> options)

Parameters

options SyncTestOptions<TInput>

Returns

NetcodeSessionBuilder<TInput>
See Also

See Also