Class ObserverBuilder
Declares one observer: what region it covers and which archetypes it reaches through.
public sealed class ObserverBuilder
- Inheritance
-
ObserverBuilder
- Inherited Members
Remarks
Phase 1 ships World only. The other three are declarable today and refused at Start with the phase that builds
them, which is deliberate: the alternative is an API that grows verbs later, so every application written against it has to be revisited when the verb it
always wanted finally exists. Declaring the full shape now costs a clear error message and buys a public surface that does not move.
An observer reaches an archetype only if that archetype is spatially indexed. Data with no position — a market, a leaderboard, a player's own inventory — is not something an observer can be pointed at; it travels as a source or as owner fields.
Methods
AroundControlled()
Follows whatever entity the session controls, with no request from the application.
public ObserverBuilder AroundControlled()
Returns
- ObserverBuilder
This builder.
At(Vector3D)
Places a sphere at a fixed world position.
public ObserverBuilder At(Vector3D position)
Parameters
positionVector3DThe centre, in world space.
Returns
- ObserverBuilder
This builder.
Remarks
It takes a position rather than a pair of horizontal coordinates on purpose: which two axes are "the ground" is the application's convention, not the engine's, and a two-argument overload silently drops the third for anyone whose world is oriented the other way.
Bind(EntityId)
Binds a sphere to an entity, so the region follows it.
public ObserverBuilder Bind(EntityId entity)
Parameters
entityEntityIdThe entity to follow.
Returns
- ObserverBuilder
This builder.
Budget(int)
Caps the bytes this observer's records may take in one frame.
public ObserverBuilder Budget(int bytes)
Parameters
bytesintThe byte budget.
Returns
- ObserverBuilder
This builder.
Far(double, double)
Adds a far tier: per-cell counts per archetype beyond the near tier, at a bounded rate.
public ObserverBuilder Far(double tileM, double maxHz)
Parameters
tileMdoubleThe aggregation tile's edge, in metres.
maxHzdoubleHow often the far tier may be refreshed, in hertz.
Returns
- ObserverBuilder
This builder.
Near(int)
Caps the entities this observer's near tier sends; beyond it the near radius shrinks and the rest feeds the far tier.
public ObserverBuilder Near(int budget)
Parameters
budgetintThe entity count the near tier is sized for.
Returns
- ObserverBuilder
This builder.
Of<TArchetype>()
Adds an archetype this observer reaches. One observer over several archetypes is what lets the engine walk a cell once for many of them.
public ObserverBuilder Of<TArchetype>() where TArchetype : Archetype<TArchetype>
Returns
- ObserverBuilder
This builder.
Type Parameters
TArchetypeThe archetype.