Scripting API

Scripting API

GameTime

Class in Abyss.Core, from Abyss.Core.

The game's clock, as World.Time gives it: how much of the game's time this frame took, how much has passed since the game started, how often its fixed systems run, and how fast its time runs.

public sealed class GameTime

Remarks

The game's time, not the time that passed. It stands still while the game is paused, runs at GameTime.Scale, and moves on by no more than the project's Maximum Allowed Timestep in one frame. GameTime.UnscaledDeltaTime is the time that really passed, for what goes on at its own pace whatever the game's time does — a pause menu's animation.

Read once a frame, from the engine as the frame starts, so every system of one frame reads the same numbers, from any thread. Inside a fixed step — while the game's fixed systems run — GameTime.DeltaTime is the step and GameTime.ElapsedTime the fixed clock's, as each fixed system's SystemContext.DeltaTime is.

A world whose frames are not run by the engine (RunFrameLoop) has no clock to read: GameTime.HasClock is false, and whatever runs it says how much time passed.

Properties

HasClock

public bool HasClock { get; }

Whether the engine runs this world's frames, and so gives it a clock to read.

DeltaTime

public float DeltaTime { get; }

Seconds of the game's time this frame: none while the game is paused, scaled, and no more than the largest step. Inside a fixed step, the step.

UnscaledDeltaTime

public float UnscaledDeltaTime { get; }

Seconds that really passed since the previous frame, whatever the game's time did.

ElapsedTime

public double ElapsedTime { get; }

Seconds of the game's time since it started: since Play, in the editor. Inside a fixed step, the fixed clock's.

FixedDeltaTime

public float FixedDeltaTime { get; }

Seconds between two runs of the game's fixed systems: the project's Fixed Timestep.

FixedOverstep

public float FixedOverstep { get; }

How far the game's time is past its last fixed step, as a part of a step from 0 to 1: how far between where the last two steps put something to draw it, so it moves smoothly at any frame rate. 0 inside a fixed step.

InFixedStep

public bool InFixedStep { get; }

Whether the game's fixed systems are running: inside a fixed step.

Scale

public float Scale { get; set; }

How fast the game's time runs: 1 as fast as time passes, 0.5 at half speed, 0 not at all. Set, it runs at that from the next frame; the project's Time Scale is what it starts at.

Exceptions