Dynamic%20entity%20system
The Dynamic Entity System (DES) is Goblin's runtime model for living worlds. This can be considered Goblin's objects system, along with some extra features.
Most programming languages stop at objects.
Goblin goes further.
Goblin provides a runtime capable of managing:
- Entities (objects)
- Traits
- Actions
- Decisions
- Ownership
- Links
- Overlays
- Transitions
- Spatial grids
- Large-scale simulation state
The Dynamic Entity System is the layer that connects all of those concepts together.
What Problem Does DES Solve?
Traditional object systems work well for applications.
They struggle when modeling worlds.
Consider a simulation with:
- Nations
- Religions
- Languages
- Cities
- Characters
- Diseases
- Trade routes
- Political borders
These systems constantly change.
Objects appear.
Objects disappear.
Objects split.
Objects merge.
Objects change identity.
Objects influence one another.
Objects move through space.
Managing those relationships manually becomes increasingly difficult as simulations grow.
DES exists to make those relationships a runtime responsibility instead of a programmer responsibility.
The Three Truths
DES is built around three different kinds of truth.
Behavioral Truth
Entities represent behavioral truth.
Entities know:
- who they are
- what they can do
- what they own
- what overlays occupy them
- what links connect them
- what they may become
Examples:
Rome <> Nation Nationalism <> Overlay Hero <> Character Sword <> Weapon
Rome <> Nation Nationalism <> Overlay Hero <> Character Sword <> Weapon
Entities contain behavior.
Spatial Truth
The Grid System represents spatial truth.
The grid knows:
- coordinates
- terrain
- ownership
- regions
- tiles
- adjacency
The grid does not know:
- actions
- decisions
- overlays
- transitions
The grid stores where things are.
Entities determine what those things do.
Lookup Truth
Indexes represent lookup truth.
The runtime maintains indexes so information can be found quickly.
Examples:
Nation -> all Nation entities Owner -> owned entities Host -> active overlays Cell -> occupying entity Entity -> current location
Nation -> all Nation entities Owner -> owned entities Host -> active overlays Cell -> occupying entity Entity -> current location
Indexes exist purely for speed.
They do not contain behavior.
They exist so the runtime does not need to search the entire world every tick.
Entities
An entity is a runtime-managed object.
Most Goblin objects are ordinary objects.
Entities are objects that participate in the world.
Examples:
Rome <> Nation Hero <> Character Sword <> Weapon
Rome <> Nation Hero <> Character Sword <> Weapon
Entities may:
- own objects
- occupy space
- receive overlays
- form links
- execute actions
- make decisions
- undergo transitions
DES tracks those relationships automatically.
Overlays
Overlays are autonomous entities that occupy other entities.
Example:
overlay Plague on Rome at .7
overlay Plague on Rome at .7
The overlay remains independent.
Rome remains independent.
The runtime manages the occupation relationship.
This relationship is part of DES.
Links
Links are runtime-derived relationships between entities.
Example:
link Nation trade by [...]
link Nation trade by [...]
DES evaluates links automatically.
Entities never manually maintain relationship graphs.
The runtime owns those relationships.
Ownership
Ownership creates containment hierarchies.
Example:
Hero └── Backpack ├── Sword └── Potion
Hero └── Backpack ├── Sword └── Potion
Ownership relationships are indexed by the runtime.
Queries such as:
owned_by(Hero)
owned_by(Hero)
can be resolved efficiently without searching every object.
Transitions
Transitions are one of the defining features of DES.
A transition changes identity, continuity, existence, or structure.
Examples:
Nation -> Cult Empire -> Successor States Faction absorbs Rival Religion fractures
Nation -> Cult Empire -> Successor States Faction absorbs Rival Religion fractures
Most object systems treat these as custom engine logic.
DES treats them as first-class runtime events.
The runtime automatically:
- creates successors
- transfers state
- updates ownership
- updates overlays
- updates links
- updates indexes
The Grid System
The Grid System provides spatial organization.
DES uses the grid to answer questions such as:
What occupies this cell? Who owns this territory? What neighbors this location? Where is this entity?
What occupies this cell? Who owns this territory? What neighbors this location? Where is this entity?
The grid remains lightweight.
Cells are not entities.
Cells are coordinates.
Entities remain the source of behavior.
Why Indexes Matter
Without indexes, the runtime would constantly search the entire world.
Example:
objects Nation
objects Nation
A naive implementation would scan every entity.
Instead DES maintains indexes:
Nation -> Rome -> Carthage -> Athens
Nation -> Rome -> Carthage -> Athens
The runtime can immediately find the result.
The same applies to:
- ownership
- overlays
- links
- locations
- transitions
Indexes make large simulations possible.
How DES Thinks
DES does not think in terms of objects alone.
DES thinks in terms of:
Identity Space Relationships Continuity
Identity Space Relationships Continuity
Identity answers:
What is this?
What is this?
Space answers:
Where is it?
Where is it?
Relationships answer:
What is connected to it?
What is connected to it?
Continuity answers:
What can it become?
What can it become?
Together these form the foundation of living-world simulation.
What DES Is Not
DES is not traditional OOP.
DES is not ECS.
DES is not an actor system.
DES is not a database.
DES borrows ideas from many systems, but its purpose is different.
DES is designed specifically for simulations, games, procedural worlds, and systems where entities evolve over time.
One Sentence
The Dynamic Entity System is Goblin's runtime framework for managing identity, behavior, relationships, continuity, and space in large-scale living worlds.