Struct RealmId
Identifies a realm: one of the strictly isolated worlds a DatabaseEngine hosts (a planet, a space sector, a building interior, a dungeon instance). An entity is in exactly one realm at a time; every spatial structure, query and replication view is scoped to one realm.
public readonly struct RealmId : IEquatable<RealmId>
- Implements
- Inherited Members
Remarks
A dense index, not a handle: realms are addressed by array index everywhere on the hot path, so the value is bounded by the engine's configured realm count and None (0xFFFF) is reserved — at most 65 535 realms.
Default (0) is the realm a single-world application lives in without ever naming one: ConfigureSpatialGrid configures
it, and a spatial archetype with no realm key lives in it.
Constructors
RealmId(ushort)
Creates a realm id from its index.
public RealmId(ushort value)
Parameters
valueushort
Fields
Default
Realm 0 — the single world of an application that never names a realm.
public static readonly RealmId Default
Field Value
MaxCount
The largest realm count an engine can be configured with (every index but None).
public const int MaxCount = 65535
Field Value
None
No realm (for example a session outside every realm). Never a valid index.
public static readonly RealmId None
Field Value
NoneValue
The raw value of None.
public const ushort NoneValue = 65535
Field Value
Value
The realm index.
public readonly ushort Value
Field Value
Properties
IsNone
True for None.
public bool IsNone { get; }
Property Value
Methods
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
Equals(RealmId)
public bool Equals(RealmId other)
Parameters
otherRealmId
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(RealmId, RealmId)
Equality.
public static bool operator ==(RealmId left, RealmId right)
Parameters
Returns
explicit operator RealmId(ushort)
A realm id from its index.
public static explicit operator RealmId(ushort value)
Parameters
valueushort
Returns
explicit operator ushort(RealmId)
The index. Explicit: None converts to 65 535, which indexes nothing, so a conversion is a decision, never an accident.
public static explicit operator ushort(RealmId realm)
Parameters
realmRealmId
Returns
operator !=(RealmId, RealmId)
Inequality.
public static bool operator !=(RealmId left, RealmId right)