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.
| Registry | manifold:relationship |
| Files | data/relationships/*.ron, *.update.ron, *.final.ron |
| Sides | both: the server and every client load it, and the handshake’s data hash covers it |
| Reads | nothing |
| Contract | Entity core (docs/architecture/entity-core.md), data stage |
Entry
A record, written Relationship(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The kind’s key, <mod-id>:<name>: also the key of the component that holds its links. | |
exclusive | bool | yes | true when an entity links to at most one target. | |
max_targets | u8 or None | no | 8 for a non-exclusive kind | The 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_target | OnDeleteTarget | yes | What happens to the link when its target is deleted. | |
on_unload_target | OnUnloadTarget | yes | What happens to the link when its target unloads. | |
persist | bool | no | true | Whether links are saved with the entity. |
replicate | RelationReplication | no | None | Which 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.
| Variant | Written | Description |
|---|---|---|
Remove | Remove | The link is removed; the entity stays. |
Delete | Delete | The entity is deleted with its target (a cascade). |
Panic | Panic | Deleting the target is a bug: the server stops with an error. |
OnUnloadTarget
What a link does when its target unloads.
| Variant | Written | Description |
|---|---|---|
Keep | Keep | The link stays and resolves again when the target reloads. |
Remove | Remove | The link is removed. |
Unload | Unload | The entity unloads with its target. |
RelationReplication
Which clients receive a data-declared kind’s links.
| Variant | Written | Description |
|---|---|---|
None | None | No client. |
Owner | Owner | The client that owns the entity. |
Party | Party | The owner’s party. |
Public | Public | Every client that has the entity in scope. |