Table of Contents

Interface ICoherenceInput

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
public interface ICoherenceInput

Properties

Buffer

Returns an underlying input buffer.

IInputBuffer Buffer { get; }

Property Value

IInputBuffer

Remarks

For advanced use cases, use with care.

BufferSize

Size of the buffer. Dictates how many frames worth of inputs can be stored. When buffer reaches its capacity a pause is requested through the ShouldPause(long, long).

int BufferSize { get; }

Property Value

int

CurrentSimulationFrame

Current simulation frame as seen by this client. If the UseFixedSimulationFrames is true this returns the ClientFixedSimulationFrame, otherwise the ClientSimulationFrame is returned.

long CurrentSimulationFrame { get; }

Property Value

long

Delay

Delay applied to the stored inputs.

int Delay { get; set; }

Property Value

int

IsProducer

If true, this client is responsible for producing inputs using SetXXX methods.

bool IsProducer { get; }

Property Value

bool

IsReadyToProcessInputs

Determines whether this input is ready for processing input data. Until this is true, all the inputs set through the SetXXX methods are overwriting each other. Only the last value set will be sent as soon as this property becomes true.

bool IsReadyToProcessInputs { get; }

Property Value

bool

IsServerSimulated

If true the input system assumes that there's a simulator or host running that processes all inputs sent by the clients while clients merely produce inputs and sync their entities with the host. Authority over this entity will be automatically transferred to the host.

bool IsServerSimulated { get; }

Property Value

bool

LastAcknowledgedFrame

Last frame received that didn't trigger a misprediction, or -1 if nothing was acknowledged yet. Might be greater than LastConsumedFrame.

long LastAcknowledgedFrame { get; }

Property Value

long

LastFrame

Last (latest) frame number for which an input was stored, received or predicted. -1 if nothing was added to the buffer yet.

long LastFrame { get; }

Property Value

long

LastReceivedFrame

Last frame number that was received from the remote input producer, or -1 if nothing was received yet.

long LastReceivedFrame { get; }

Property Value

long

LastSentFrame

Last frame number that was dequeued for sending, or -1 if nothing was sent yet.

long LastSentFrame { get; }

Property Value

long

MispredictionFrame

Frame at which last prediction failure has been detected.

long? MispredictionFrame { get; }

Property Value

long?

Remarks

Value is nulled-out as soon as the input is retrieved for that or subsequent frames. For this reason this property should be inspected before any input retrieving method in a given frame in order to check whether the simulation correction is required.

ProcessingEnabled

Determines whether the input processing will happen. If disabled inputs won't be stored in the buffer and won't be sent. Affects only the input-producing side. Defaults to true.

bool ProcessingEnabled { get; }

Property Value

bool

Methods

ShouldPause(long)

If true, the buffer cannot do any more predictions. Client should pause the game and stop polling inputs to not lose any data required for a rollback.

bool ShouldPause(long commonReceivedFrame)

Parameters

commonReceivedFrame long

Common (lowest) received frame for all inputs in the simulation.

Returns

bool