Scripting API
Scripting API
TimeSettings
Class in Abyss.Core, from Abyss.Core.
A game's clock: settings/time.json beside the game's assets, which Project Settings' Time page lays out — how often its fixed systems run, how far one frame may move the game's time on, and how fast that time runs.
public sealed class TimeSettingsRemarks
The fixed timestep is the time between two runs of the game's fixed systems (Schedule.Fixed): a sixtieth of a second unless a game says otherwise, and the SystemContext.DeltaTime each of them is given. They run as many times a frame as the game's time has moved on by a step, so a game runs them as often at 30 frames a second as at 144.
The maximum allowed timestep is the most one frame may move the game's time on: a frame that took longer — a load, a breakpoint — moves it on by this much, and is followed by as many fixed steps as fit in it rather than in the whole frame.
The time scale is how fast the game's time runs as the game starts: 1 as fast as time passes, a half at half speed, 0 not at all. A game changes it as it plays with GameTime.Scale.
Properties
FixedTimestep
public double FixedTimestep { get; set; }Seconds between two runs of the game's fixed systems.
MaximumAllowedTimestep
public double MaximumAllowedTimestep { get; set; }The most seconds one frame may move the game's time on, however long it took.
TimeScale
public double TimeScale { get; set; }How fast the game's time runs as it starts: 1 as fast as time passes, 0 not at all.
FixedRate
public double FixedRate { get; }How many times a second the fixed systems run: 60 for a sixtieth of a second.
Methods
FileIn
public static string FileIn(string game)Where a game keeps it: settings/time.json in its folder.
Parameters
game
Read
public static TimeSettings Read(string game)A game's settings; the defaults for one with no time.json.
Parameters
game
Exceptions
FormatException: The file is not settings this build reads, saying why.IOException: The file is there and cannot be read.
Parse
public static TimeSettings Parse(string json)Settings from their text.
Parameters
json
Exceptions
FormatException: It is not settings this build reads, or a number in it is one no clock can be given, saying why.
WhyNot
public string? WhyNot()What is wrong with the numbers for a clock: a step shorter than TimeSettings.ShortestStep or longer than TimeSettings.LongestStep, a largest frame shorter than a step or longer than a second, or a scale below 0 or above TimeSettings.Fastest; null when nothing is.
ToJson
public string ToJson()The settings as their file holds them.
Write
public void Write(string game)Writes the settings into a game's folder.
Parameters
game
Copy
public TimeSettings Copy()A copy, to change without changing this.
Constants
FileName
public const string FileName = "time.json"The file, under the game's settings folder.
PathName
public const string PathName = "settings/time.json"What it is called in a game's folder and in its pack: settings/time.json.
CurrentVersion
public const int CurrentVersion = 1The version of the file this build writes, and the newest it reads.
ShortestStep
public const double ShortestStep = 0.0001The shortest fixed timestep a game can have: ten thousand steps a second.
LongestStep
public const double LongestStep = 1The longest fixed timestep, and the largest frame, a game can have: a second.
Fastest
public const double Fastest = 100The fastest a game's time can run.
