Skip to Content
ArchitectureState & GnosisStoreGnosisStore (Internal)

GnosisStore

The GnosisStore is the underlying storage engine for all engine state. It manages flat arrays and pools for values, objects (dictionaries), and lists.

Key Features:

  • Zero-Allocation: Once the initial pools are warmed up, updating the store (setting values, adding to lists) does not trigger the C# Garbage Collector.
  • Handle-Based: Data is stored in internal arrays; the “objects” you interact with are just integer handles.
  • Unified Storage: All state, from player HP to complex JSON configurations, lives in the same store.

How it works internally

Internally, the GnosisStore maintains several “Shelves” of data:

  • Shelf A (Values): A pool of GnosisValue structs (union structs for primitives).
  • Shelf B (Objects): A pool of Dictionary<int, int> which map hashed keys to value handles.
  • Shelf C (Lists): A pool of List<int> which store sequences of value handles.

When you create a “New Object”, the engine simply pulls an unused dictionary from the pool and returns a handle to it. This design ensures extreme performance even in high-frequency game loops.

Last updated on