TimeMachine<T>

class TimeMachine<T> : System.Object, Protogame.ITimeMachine<T>, Protogame.ITimeMachine

This class facilitates lag compensation and value prediction for data that is being synchronized over a latent stream (such as a network connection). For interpolation and extrapolation, use T:Protogame.InterpolatedTimeMachine`1.

Type Parameters:
 
  • T – The type of data that will be tracked by the time machine.
readonly System.Type Type

The type of the values stored by this time machine.

public void FindSurroundingTickValues(System.Collections.Generic.IList<Int32> keys, int current, ref int previous, ref int next)
Parameters:
  • keys (System.Collections.Generic.IList<Int32>) –
  • current (int) –
  • (ref) previous (int) –
  • (ref) next (int) –
public Protogame.T Get(int tick)

Retrieves the value at the specified tick, or interpolates / extrapolates a value from the known values in the time machine.

Parameters:
  • tick (int) – The tick at which to retrieve the value.
Returns:

The .

public void Purge(int tick)

Purges old history in the time machine, freeing up memory.

Parameters:
  • tick (int) – The current tick. This value minus the history setting will be the tick from which older ticks will be removed.
public void Set(int tick, System.Object value)

Sets the specified tick and value into the time machine. Once you have set a value at a specified time, you can only set values with a higher tick.

Parameters:
  • tick (int) – The tick at which this value exists.
  • value (System.Object) – The value to store in the time machine.
public void Set(int tick, Protogame.T value)
Parameters:
  • tick (int) –
  • value (Protogame.T) –