template<typename TNet, typename TRollback, typename TFrame>
LogicThread class

The Brain — fixed-timestep simulation coordinator for one World.

Template parameters
TNet Input injection and replication dispatch. SoloSim (offline) | AuthoritySim (server/Host) | OwnerSim (client).
TRollback Correction history. NoRollback (zero overhead) | RollbackSim (N-frame ring + queues).
TFrame Editor branching. GameFrame (shipping) | EditorFrame (PIE / tick-pause).

Three independent compile-time policy axes produce exactly one concrete type:

All method bodies live in LogicThread.cpp; explicit instantiations there are the only definitions. External code holds LogicThreadBase* to avoid coupling to a specific specialization.

Base classes

class LogicThreadBase
Non-template base class for all LogicThread<> specializations.

Constructors, destructors, conversion operators

LogicThread() defaulted
~LogicThread() defaulted override

Public functions

void Initialize(Registry* registry, const EngineConfig* config, JoltPhysics* physics, InputBuffer* simInput, InputBuffer* vizInput, TrinyxJobs::WorldQueueHandle worldQueue, const std::atomic<bool>* jobsInitialized, int windowWidth, int windowHeight) override
Bind all non-owning pointers and prepare the thread for Start().
void Start() override
Spawn the Brain thread and begin the fixed-rate loop.
void Stop() override
Signal the Brain thread to exit after the current frame.
void Join() override
Block the caller until the Brain thread exits.
auto GetNetMode() -> TNet&
Expose the concrete net policy so AuthorityNet/OwnerNet can call Bind() after world creation.
auto GetPhysicsDivizor() const -> uint32_t
Physics sub-step divisor derived from EngineConfig at Initialize time.

Private functions

void TickOnce() virtual
Run one complete simulation frame synchronously on the calling thread.

Function documentation

template<typename TNet, typename TRollback, typename TFrame>
void LogicThread<TNet, TRollback, TFrame>::Initialize(Registry* registry, const EngineConfig* config, JoltPhysics* physics, InputBuffer* simInput, InputBuffer* vizInput, TrinyxJobs::WorldQueueHandle worldQueue, const std::atomic<bool>* jobsInitialized, int windowWidth, int windowHeight) override

Bind all non-owning pointers and prepare the thread for Start().

Parameters
registry
config
physics
simInput
vizInput
worldQueue World-scoped job queue handle; Brain submits pre/post-physics jobs here.
jobsInitialized Engine jobs-ready gate; Brain spins on this before draining the queue.
windowWidth
windowHeight

template<typename TNet, typename TRollback, typename TFrame>
void LogicThread<TNet, TRollback, TFrame>::TickOnce() virtual private

Run one complete simulation frame synchronously on the calling thread.

Intended for editor use after level load, before the background thread starts. Advances the accumulator, runs Constructs, writes a temporal frame, and increments LastCompletedFrame.