-
Notifications
You must be signed in to change notification settings - Fork 13
GameClock
The GameClock keeps track of game ticks, each game tick represents one physics frame. The game clock will use ping updates from the GameSynchronizer to ensure all clients are at the same game tick.
In addition it tracks how far behind we need to run nodes that we are not the master of based on the ping of the other players. For instance if the ping to other players is 160 all nodes owned by other players will be run 10~ game ticks behind assuming a physics frame rate of 60 physics frames per second.
This event happens every time there is a new game tick. Will also happen on skipped game ticks.
- Tick - The current tick.
If for some reason we end up being behind the server or a physics frame is dropped this event will trigger and notify about a game tick being skipped.
- Tick - The skipped tick.
This happens when we need to skip a remote tick to adjust the remote offset between clients. Will happen if ping between clients decreases.
- Tick - The skipped tick.
Triggers when ticks are adjusted from the outside, such as when you join a game in progress.
- Tick - The new tick we are at.
Sets the current tick to the given tick. Will trigger an OnGameTickChanged event.
- Tick - The new tick we should be adjusted to.
Get the current local tick
- Return - The current tick we are at.
Get the current remote tick we are using for remote nodes. Will be slightly behind GetTick() based on the current ping between players and the server.
- Return - The current remote tick.
Get time in milliseconds (OS.GetTickMsec() format) until the tick or since the tick.
- Tick - The tick we want the time of.
- Return - The time until / since the tick.
Returns the tick that we will be in at the given offset (msec).
- Offset - The time offset in milliseconds from the current time (eg. If you want the tick 2 seconds from now this would be 2000).
- Return - The tick that we will be at / were at based on offset time.
This method is used by the GameSynchronizer and it is adviced not to use it unless you know what you are doing. Clients recieve this from the server as a way to attempt to keep them in synch in case they or the server freeze for any reason.
Currently there is no configuration for the GameClock