data/archetypes/
An archetype: a kind of entity, such as the player, a boar or a pet, with the components every instance carries and their default values. Spawning names an archetype (/entity spawn mymod:boar). An archetype may inherit from a parent, list components an instance may gain later, and choose among variants when it spawns. Component values are written in each component’s own schema; the components themselves are declared in code. The gameplay, AI and navigation registries are reached from here through components that name their entries (a brain, a locomotion profile, a loot table).
| Registry | manifold:archetype |
| Files | data/archetypes/*.ron, *.update.ron, *.final.ron |
| Sides | both: the server and every client load it, and the handshake’s data hash covers it |
| Reads | manifold:component, manifold:spatial-layer |
| Contract | Archetypes, data stage |
Entry
A record, written Archetype(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The archetype’s key, <mod-id>:<name>, in the declaring mod’s namespace. | |
parent | string or None | no | none | The archetype this one inherits from. The child merges over its parent: records by field and maps by key, while lists and scalars replace. optional lists are joined, and a parent’s abstract, remove and (when the child has its own) variants are not inherited. |
abstract | bool | no | false | true for a parent that never spawns. Not inherited. |
copyable | bool | no | false | Whether the clipboard and blueprints may copy instances. Inherited. |
persistence | Persistence | no | Session | Where instances are saved. A spawn may override it. |
spatial_layers | list of string | no | none | The spatial index layers instances occupy: manifold:spatial-layer keys, or a bare name for the engine’s (player, creature, item, projectile, prop). |
bounds_radius | f32 | no | 0.5 | The radius, in metres, the spatial index gives each instance. |
tags | list of string | no | none | Tags (manifold:tag keys) every instance starts with. |
components | map of string to component-value | no | none | The components every instance carries, by component key, each with its value; () takes the component’s defaults. A child’s value merges into its parent’s; Replace(value) replaces it instead. Components that a listed component requires are added with their defaults. |
optional | list of string | no | none | Components an instance may gain while it lives, by key. Joined with the parent’s list. |
remove | list of string | no | none | Inherited components this archetype drops, by key. |
variants | list of Variant | no | one variant, the archetype itself | Spawn-time variants. Exactly one has no when: the fallback. |
Example
From game/flagship-game/data/archetypes/pet.ron:
Archetype(
id: "flagship-game:pet",
persistence: Saved,
spatial_layers: ["creature"],
bounds_radius: 0.45,
components: {
"manifold-sim:position": (),
"manifold-sim:velocity": (),
"manifold-sim:yaw": (),
"manifold-sim:pitch": (),
"manifold-sim:motion-mode": (),
"manifold-model:model": (asset: "flagship:creatures/pet"),
"manifold-anim:anim-setup": (bindings: "flagship:animations/pet"),
"manifold-anim:hit-eval": (mode: Lazy),
"manifold-model:event-cues": (events: ["footstep"], sounds: ["flagship:block/place"],
effects: [""], threshold: 0.5),
"manifold-nav:locomotion": (profile: "flagship-game:pet"),
"manifold-gameplay:stats": (base: { "manifold:max_health": 16.0 }),
"manifold-gameplay:damage-receiver": (death: (corpse: Linger(ticks: 40), despawn: AfterCorpse)),
"manifold-gameplay:faction": (inherit_owner_faction: true),
"manifold-ai:brain": (def: "flagship-game:pet"),
"manifold-ai:ai-presentation": (),
},
)
Types
Persistence
Where an archetype’s instances are saved.
| Variant | Written | Description |
|---|---|---|
Saved | Saved | Saved with the world. |
External | External | Saved by another system, such as a player’s own record. |
Session | Session | Never saved: gone after a restart. |
Variant
A spawn-time variant of an archetype. Variants are tried in descending priority, ties in the order written, and the first whose when holds is chosen.
A record: Variant(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The variant’s name within its archetype (tusker). A spawn may name it (/entity spawn flagship-game:boar#tusker). | |
when | condition or None | no | None | When the variant applies: Some(Chance(0.1)), or any condition the spawn context can read (the spawn position, the biome). None is the fallback, which always holds. |
priority | i32 | no | 0 | Higher priorities are tried first. |
patch | map of string to component-value | no | none | Component values that override or add to the archetype’s, merged in the same way as a child’s. |
Value forms used here: component-value, condition.