EngineConfig struct
#include <Runtime/Core/Public/EngineConfig.h>
Runtime configuration for a TrinyxEngine instance.
Loaded from INI files at startup with cascading precedence (most-specific wins):
- Game:
{ProjectName}Defaults.ini→TrinyxDefaults.ini→ compiled defaults - Editor overlay:
EditorDefaults.ini→ game config fills gaps
All integer fields use Unset as a sentinel meaning "not set; use compiled default." Call ApplyDefaults() after loading to resolve all sentinels before use.
Public static variables
- static int Unset constexpr
- Sentinel: field has not been assigned by any config file.
Public static functions
- static auto LoadProjectConfig(const char* projectDir) -> EngineConfig
- Load the cascading game config for
projectDir. - static auto LoadEditorConfig(const char* projectDir, const EngineConfig& gameConfig) -> EngineConfig
- Load the editor config overlay on top of
gameConfig. - static auto LoadFromFile(const char* path) -> EngineConfig
- Load a single INI file into a config struct.
Public functions
- void FillFrom(const EngineConfig& other)
- Copy all
Unsetint fields and empty strings fromotherinto this config. - void ApplyDefaults()
- Replace all remaining
Unset/ empty fields with compiled-in defaults. - auto GetTargetFrameTime() const -> double
- Main-loop target frame time in seconds.
- auto GetFixedStepTime() const -> double
- Fixed simulation step duration in seconds.
- auto GetNetworkStepTime() const -> double
- Network update interval in seconds (time between state-correction sends).
- auto GetInputNetHz() const -> int
- Resolved InputNetHz, falling back to 128 if
Unset. - auto GetInputNetStepTime() const -> double
- Client input packet interval in seconds.
- auto GetSlabUploadInlineThreshold() const -> int
- Dirty entity count below which slab upload runs inline on the render thread (no job dispatch).
- auto GetSlabUploadSingleJobThreshold() const -> int
- Dirty entity count below which a single bundled job uploads all fields.
Public variables
- bool Headless
- No window, renderer, or GPU. Implied by
TNX_NET_MODEL=Server. - bool EnableThreadPinning
- Assign threads to specific cores for reduced jitter. Disable in PIE.
- int MaxFrames
- Exit after this many Sentinel frames. 0 = run indefinitely (CI: set to ~60).
- int TargetFPS
- Main-loop frame rate cap. Cannot be lower than FixedUpdateHz if set.
- int FixedUpdateHz
- Fixed-timestep logic rate (e.g., 128 or 512 Hz).
- int PhysicsUpdateInterval
- Fixed steps per Jolt step. 8 = 64 Hz physics at 512 Hz sim.
- int NetworkUpdateHz
- State-correction send rate ("tick rate"). Lower = less bandwidth.
- int ClockSyncProbes
- RTT probe count during Synchronizing before computing InputLead. Default: 8, range: 1–255.
- int InputPollHz
- Sentinel input-poll rate; higher = lower input latency.
- int InputNetHz
- Rate at which the client sends InputFrame packets to the Authority.
- int InputDelayFrames
- Artificial input delay in sim frames for lockstep/deterministic play.
- int MaxClientInputLead
- Max sim frames the Authority may predict ahead of a client's last received input.
- int MAX_RENDERABLE_ENTITIES
- Arena 1 capacity (Render + Dual partitions). Must be ≤ MAX_CACHED_ENTITIES.
- int MAX_CACHED_ENTITIES
- Max dynamic entities across all arenas combined.
- int MAX_JOLT_BODIES
- Sizes the Jolt body interface, temp allocator, and mapping arrays.
- int TemporalFrameCount
- Temporal ring depth. Min 8, power-of-2. At 512 Hz: 128 frames ≈ 0.25 s of history.
- int JobCacheSize
- Pre-allocated job queue capacity. Exceeding this value will assert.
- int SlabUploadInlineThreshold
- Dirty entity count below which GPU slab upload runs inline on the render thread.
- int SlabUploadSingleJobThreshold
- Dirty entity count below which a single bundled job uploads all fields sequentially.
- char ProjectDir
- Project root directory (set from TNX_PROJECT_DIR or Initialize() argument).
- char DefaultScene
- Scene to load on startup (relative to ProjectDir/content/).
- char DefaultState
- Flow state name to load on startup (e.g., "MainMenu").
- uint16_t NetPort
- GNS connection port (CLI: –port).
- char NetAddress
- Remote address for client connections (CLI: –client <ip>).
- int EngineLogLevel
- Min log level for the engine channel. 0=Trace … 4=Error.
- int GameLogLevel
- Min log level for the game channel. 0=Trace … 4=Error.
- bool NoNagle
- Disable GNS Nagle coalescing for all unreliable sends.
- int SendRateMin
- GNS per-connection send rate floor (bytes/sec). Unset = GNS default (256 KB/s).
- int SendRateMax
- GNS per-connection send rate cap (bytes/sec).
- int AudioUpdateHz
- Sentinel audio update rate (fade processing, stream refill). Default: 250 Hz.
- int MaxAudioVoices
- Maximum simultaneous voices; exceeded voices are stolen by priority.
Function documentation
static EngineConfig EngineConfig:: LoadProjectConfig(const char* projectDir)
Load the cascading game config for projectDir.
Walks {ProjectName}Defaults.ini → TrinyxDefaults.ini → compiled defaults. Project name is derived from the directory name.
static EngineConfig EngineConfig:: LoadEditorConfig(const char* projectDir,
const EngineConfig& gameConfig)
Load the editor config overlay on top of gameConfig.
| Parameters | |
|---|---|
| projectDir | |
| gameConfig | Game config to fall back to for fields not set by editor INI files. |
Walks EditorDefaults.ini (projectDir) → EditorDefaults.ini (engineDir) → gameConfig fills gaps.
static EngineConfig EngineConfig:: LoadFromFile(const char* path)
Load a single INI file into a config struct.
| Returns | Compiled defaults if the file does not exist. |
|---|
double EngineConfig:: GetTargetFrameTime() const
Main-loop target frame time in seconds.
| Returns | 0.0 if uncapped; otherwise 1.0 / min(TargetFPS, FixedUpdateHz) in non-editor builds. |
|---|
Variable documentation
int EngineConfig:: InputDelayFrames
Artificial input delay in sim frames for lockstep/deterministic play.
int EngineConfig:: MaxClientInputLead
Max sim frames the Authority may predict ahead of a client's last received input.
int EngineConfig:: SlabUploadInlineThreshold
Dirty entity count below which GPU slab upload runs inline on the render thread.
int EngineConfig:: SlabUploadSingleJobThreshold
Dirty entity count below which a single bundled job uploads all fields sequentially.
bool EngineConfig:: NoNagle
Disable GNS Nagle coalescing for all unreliable sends.
int EngineConfig:: SendRateMin
GNS per-connection send rate floor (bytes/sec). Unset = GNS default (256 KB/s).