Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

data/relationships/

A relationship kind: a typed link from one entity to others, such as a pet’s tamed-by link to its owner. The kind’s key is also the key of the component that holds an entity’s links. Its policy says how many targets an entity may link to, what happens to the link when a target is deleted or unloads, whether links are saved, and who sees them. The engine declares the kinds the ECS core ships (manifold-ecs:child-of, manifold-ecs:owned-by, manifold-ecs:targets); archetypes list a kind’s component as () and the spawn supplies the targets.

Registrymanifold:relationship
Filesdata/relationships/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsnothing
ContractEntity core (docs/architecture/entity-core.md), data stage

Entry

A record, written Relationship(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe kind’s key, <mod-id>:<name>: also the key of the component that holds its links.
exclusiveboolyestrue when an entity links to at most one target.
max_targetsu8 or Noneno8 for a non-exclusive kindThe most targets an entity may link to, 2 to 32. Only for a non-exclusive kind; an exclusive kind has exactly one and leaves it out.
on_delete_targetOnDeleteTargetyesWhat happens to the link when its target is deleted.
on_unload_targetOnUnloadTargetyesWhat happens to the link when its target unloads.
persistboolnotrueWhether links are saved with the entity.
replicateRelationReplicationnoNoneWhich clients receive the links.

Example

No bundled file declares one yet. From the reference’s test fixture, crates/manifold-server-state/tests/data-reference-fixture/data/relationships/tamed_by.ron, which the data stage loads in its tests:

Relationship(
    id: "dataref-fixture:tamed-by",
    exclusive: true,
    on_delete_target: Remove,
    on_unload_target: Keep,
    persist: true,
    replicate: Public,
)

Types

OnDeleteTarget

What a link does when its target is deleted.

VariantWrittenDescription
RemoveRemoveThe link is removed; the entity stays.
DeleteDeleteThe entity is deleted with its target (a cascade).
PanicPanicDeleting the target is a bug: the server stops with an error.

OnUnloadTarget

What a link does when its target unloads.

VariantWrittenDescription
KeepKeepThe link stays and resolves again when the target reloads.
RemoveRemoveThe link is removed.
UnloadUnloadThe entity unloads with its target.

RelationReplication

Which clients receive a data-declared kind’s links.

VariantWrittenDescription
NoneNoneNo client.
OwnerOwnerThe client that owns the entity.
PartyPartyThe owner’s party.
PublicPublicEvery client that has the entity in scope.