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)
Get string representation of the state Used for Sync Test logging CreateSyncTestSession<TInput>(FrameSpan?, NetcodeOptions?, SessionServices<TInput>?, IStateDesyncHandler?, bool)
string GetStateString(in Frame frame, ref readonly BinaryBufferReader reader)
Parameters
frame
Framereader
BinaryBufferReader
Returns
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
FrameThe loading frame
reader
BinaryBufferReaderBinary state reader
OnPeerEvent(PlayerHandle, PeerEventInfo)
Notification that some PeerEvent has happened for a PlayerHandle
void OnPeerEvent(PlayerHandle player, PeerEventInfo evt)
Parameters
player
PlayerHandleThe player owner of the event
evt
PeerEventInfoEvent 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
FrameThe frame which the save occurs.
writer
BinaryBufferWriterBinary 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
FrameSpanIndicates how many frames the client is ahead