data/stats/
A stat: a number an entity carries, such as health, strength or armour. A stat has a base, which archetypes set (manifold-gameplay:stats), and modifiers from effects, equipment and abilities that change its value in one fixed order. A resource (health) is a current value bounded by another stat; a derived stat’s base is a formula over the entity’s other stats. Damage formulas, conditions and hooks read stats. The engine declares the core pack: manifold:max_health, manifold:health, manifold:incoming_damage, manifold:incoming_healing, manifold:knockback_resistance and manifold:cooldown_rate.
| Registry | manifold:stat |
| Files | data/stats/*.ron, *.update.ron, *.final.ron |
| Sides | both: the server and every client load it, and the handshake’s data hash covers it |
| Reads | manifold:predicate |
| Contract | Gameplay framework, data stage |
Entry
A record, written Stat(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The stat’s key, <mod-id>:<name>. | |
kind | StatKind or None | no | Attribute | What kind of stat. |
base | f32 | no | 0 | The base value of an entity whose archetype does not set one (for a resource, its starting value). |
min | f32 | no | -1e9 | The lowest value. |
max | f32 | no | 1e9 | The highest value. |
rounding | Rounding | no | None | Rounding applied after the clamp. |
audience | StatAudience | no | Server | Who sees the value. |
predict | bool | no | false | Whether the owning client may predict changes to it. |
persist | bool | no | false | Whether the base (a resource’s current value) is saved. |
ui | StatUi or None | no | <mod>.stat.<id>.name and so on | Player-facing text. |
derived | number or None | no | not derived | A formula over the same entity’s other stats that replaces the base ("20 + 5 * q.stat('this', 'x:vitality')"). Only an attribute may be derived; it may read only its own entity’s stats, never itself, and derived stats may not form a cycle. |
Example
From game/flagship-game/data/stats/combat.ron:
Stat(id: "flagship-game:armor", base: 0.0, min: 0.0, max: 10000.0, audience: Owner)
Types
StatKind
What kind of stat.
| Variant | Written | Description |
|---|---|---|
Attribute | Attribute | A plain value. |
Resource | Resource(max: .., on_max_change: ..) | A current value bounded by another stat (health by max health). |
Meta | Meta | Transient: scales one value, then resets (manifold:incoming_damage). |
Resource fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
max | string | yes | The stat that bounds it (manifold:stat key), not itself. | |
on_max_change | MaxChange | no | KeepFraction | What happens to the current value when the maximum changes. |
MaxChange
What a resource does when its maximum changes.
| Variant | Written | Description |
|---|---|---|
KeepFraction | KeepFraction | Keeps the same fraction of the maximum. |
KeepValue | KeepValue | Keeps the value, clamped to the new maximum. |
Rounding
Rounding after the clamp.
| Variant | Written | Description |
|---|---|---|
None | None | No rounding. |
Floor | Floor | Down to a whole number. |
Nearest | Nearest | To the nearest whole number. |
StatAudience
Who sees a stat’s value.
| Variant | Written | Description |
|---|---|---|
Server | Server | Only the server. |
Owner | Owner | The server and the entity’s owner. |
Party | Party | The owner’s party too. |
Public | Public | Every client with the entity in scope. |
StatUi
A stat’s player-facing text, as message keys.
A record: StatUi(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string or None | no | <mod>.stat.<id>.name | The name’s message key. |
description | string or None | no | none | The description’s message key. |
icon | string or None | no | none | An icon asset. |
Value forms used here: number.