Registry class
#include <Runtime/Memory/Public/Registry.h>
Central entity management system.
Manages three independent handle spaces:
GlobalEntityHandle(GHandle) — internal record identity; indexesRecords[].EntityHandle(LHandle) — OOP / Construct-facing handle; indexesLocalToRecord[].EntityNetHandle(NetHandle) — network replication handle; indexesNetToRecord[].
Index 0 is reserved / invalid in all three spaces.
Creation flow:
CreateInternal(classID, span<GHandle>)— allocates records and archetype slots.MakeEntityHandle(GHandle, classID)— allocates a local index, wiresLocalToRecord.- Public API (
Create<T>,CreateByClassID) — wraps the above, returnsEntityHandle.
Destruction flow:
Destroy(LHandle)— defersGHandletoPendingDestructions.ProcessDeferredDestructions— removes from archetype, callsFreeGlobalHandle.FreeGlobalHandle— reclaims record index, queues local / net handle recycling.ConfirmLocalRecycles/ConfirmNetRecycles— moves pending → free after the safety window.
Public types
- struct ServerEventEntry
Public static functions
Constructors, destructors, conversion operators
- Registry()
- Registry(const EngineConfig* config)
- ~Registry()
Public functions
-
template<typename T>auto Create() -> EntityHandle
-
template<typename T, std::invocable<T&> Fn>auto Create(Fn&& fn) -> EntityHandle
-
template<typename T>auto Create(size_t count) -> std::vector<EntityHandle>
-
template<std::invocable<EntityRecord&, void**> Fn>auto CreateByClassID(ClassID classID, Fn&& fn) -> EntityHandle
- void Recreate(EntityHandle& inHandle)
-
template<typename T>void RecreateAs(EntityHandle& inHandle)
- void RecreateAs(EntityHandle& inHandle, const EntityHandle& asHandle)
- void Destroy(EntityHandle lHandle)
- void DestroyByGlobalHandle(GlobalEntityHandle gHandle)
- void ForceDestroyByGlobalHandle(GlobalEntityHandle gHandle)
- void ProcessDeferredDestructions()
- void ConfirmTombstone(uint32_t recordIndex)
- auto IsTombstoned(uint32_t recordIndex) const -> bool
-
template<typename T>auto HasComponent(EntityHandle lHandle) -> bool
-
template<typename... Components>auto ComponentQuery() -> std::vector<Archetype*>
-
template<typename... Classes>auto ClassQuery() -> std::vector<Archetype*>
- void InvokeScalarUpdate(SimFloat dt)
- void InvokePrePhys(SimFloat dt)
- void InvokePostPhys(SimFloat dt)
- void TickDefrag(TrinyxJobs::WorldQueueHandle wq)
- void ForceDefragSync()
-
auto GetVolatileCache() -> ComponentCache<CacheTier::
Volatile>* -
auto GetTemporalCache() -> ComponentCache<CacheTier::
Temporal>* - auto SweepAliveFlagsToActive() -> int
- auto CheckAndCorrectEntityTransform(const EntityTransformCorrection& correction) -> bool
- void PushServerEvent(ServerEventEntry entry)
- void ReplayServerEventsAt(uint32_t frame)
- void PruneServerEvents(uint32_t oldestFrame)
- void PushEntityReinitEvent(GlobalEntityHandle gHandle, uint32_t frame)
- auto GetTotalChunkCount() const -> uint32_t
- auto GetTotalEntityCount() const -> uint32_t
- auto GetArchetypes() const -> const auto&
- auto GetRecordByCache(EntityCacheHandle cacheHandle) const -> EntityRecord
- auto GetRecord(EntityHandle handle) const -> EntityRecord
-
template<typename T, void(T::*)(uint32_t, uint32_t) MemFn>void BindOnCacheSlotChange(EntityHandle handle, T* obj)
-
template<typename T, void(T::*)(uint32_t, uint32_t) MemFn>void UnbindOnCacheSlotChange(EntityHandle handle, T* obj)
- auto FindEntityByLocation(EntityCacheHandle cacheHandle) const -> GlobalEntityHandle
Public variables
- std::atomic<uint32_t> RenderAck
- uint32_t LastPublishedFrame
- bool RenderHasAcked
- bool ReplicationActive