-
-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: Startup Wiring and Timer Resolution
Tsu edited this page May 31, 2026
·
2 revisions
This feature page covers what ServerSystemStratum wires at startup.
In OnBeginConfiguration(), Stratum loads config, applies system toggles, and optional diagnostics.
StratumBlockEntityInitConfig beInit = StratumRuntime.Config.Performance.BlockEntityInit;
BlockEntity.StratumDefaultInitialDelaySpreadMs = (beInit != null && beInit.Enabled) ? beInit.MaxStaggerMs : 0;On Windows, Stratum can call timeBeginPeriod based on config:
[DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")]
private static extern uint StratumTimeBeginPeriod(uint period);StratumTimerResolutionConfig timerCfg = StratumRuntime.Config.Performance.TimerResolution;
if (timerCfg != null && timerCfg.Enabled && stratumActiveTimerPeriodMs == 0
&& RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
uint period = (uint)Math.Max(1, timerCfg.PeriodMs);
uint result = StratumTimeBeginPeriod(period);
...
}This is meant to improve sleep granularity for server tick pacing on Windows.
if (StratumRuntime.Config.Performance.Timings.EnabledOnStartup)
{
StratumRuntime.Timings.Start();
}
if (StratumRuntime.Config.Diagnostics.RunStartupPreflight)
{
StratumPreflightReport report = StratumRuntime.RunPreflight();
...
}In OnBeginRunGame(), Stratum initializes runtime services and stamps world identity keys.
if (server?.World?.Config != null)
{
server.World.Config.SetBool(StratumInfo.Id, true);
server.World.Config.SetString(StratumInfo.Id + "Version", StratumInfo.Version);
server.World.Config.SetString(StratumInfo.Id + "BaseGameVersion", StratumInfo.BaseGameVersion);
}Those keys are synced to clients and can be used by mods to detect Stratum.
sources/VintagestoryLib/Vintagestory/Server/ServerSystemStratum.cssources/VintagestoryLib/Vintagestory/Server/StratumConfig.cswiki/Detection-and-Compatibility.md