Game.Simulation.ISimulationSystem
Assembly: Assembly-CSharp (game code assembly; confirm exact assembly in your modding environment)
Namespace: Game.Simulation
Type: Interface
Base: None
Summary:
ISimulationSystem is a lightweight interface surface exposing basic per-frame information and the currently selected simulation speed. Implementers are simulation subsystems that need to read (and in the case of selectedSpeed, adjust) frame-related values for each simulation step. This interface does not define lifecycle methods; it only provides properties to access frame index, frame time, and the user-selected speed multiplier.
Fields
- None
No fields are declared on this interface. Implementations will provide backing storage as needed.
Properties
-
public uint frameIndex { get; }
Current simulation frame index. Read-only. Typically increments each simulation step and can be used to detect or synchronize per-frame changes. -
public float frameTime { get; }
Frame time associated with the current simulation frame (measured in seconds). Read-only. Represents the time value the simulation step is using — useful for time-based calculations. -
public float selectedSpeed { get; set; }
Selected simulation speed multiplier. Read/write. Reflects the speed chosen by the player or UI and can be read by systems to scale time-dependent logic; also settable to change the current simulation speed programmatically.
Constructors
- None
Interfaces do not declare constructors. Concrete implementations must provide construction/initialization.
Methods
- None
This interface does not define methods. Behavior is expressed via the three properties above.
Usage Example
// Simple example implementation of ISimulationSystem
public class MySimulationSystem : ISimulationSystem
{
// Backing fields
private uint m_frameIndex;
private float m_frameTime;
private float m_selectedSpeed = 1.0f;
// Interface implementation
public uint frameIndex => m_frameIndex;
public float frameTime => m_frameTime;
public float selectedSpeed
{
get => m_selectedSpeed;
set => m_selectedSpeed = value;
}
// Example update called by the simulation driver
public void Step(float deltaTime)
{
m_frameIndex++;
m_frameTime = deltaTime;
// Use selectedSpeed to scale per-frame updates
float scaledDelta = deltaTime * m_selectedSpeed;
// ... perform simulation work using scaledDelta ...
}
}
{{ This interface is intentionally minimal. When integrating into Cities: Skylines 2 mod code, implementers typically obtain frame timing and speed from the game's simulation driver and use these properties to keep custom systems deterministic and synchronized with the main simulation. Confirm the exact semantics of frameTime and frameIndex against the current game version or available engine documentation if precise timing behavior matters for your mod. }}