Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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.

Registrymanifold:stat
Filesdata/stats/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsmanifold:predicate
ContractGameplay framework, data stage

Entry

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

FieldTypeRequiredDefaultDescription
idstringyesThe stat’s key, <mod-id>:<name>.
kindStatKind or NonenoAttributeWhat kind of stat.
basef32no0The base value of an entity whose archetype does not set one (for a resource, its starting value).
minf32no-1e9The lowest value.
maxf32no1e9The highest value.
roundingRoundingnoNoneRounding applied after the clamp.
audienceStatAudiencenoServerWho sees the value.
predictboolnofalseWhether the owning client may predict changes to it.
persistboolnofalseWhether the base (a resource’s current value) is saved.
uiStatUi or Noneno<mod>.stat.<id>.name and so onPlayer-facing text.
derivednumber or Nonenonot derivedA 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.

VariantWrittenDescription
AttributeAttributeA plain value.
ResourceResource(max: .., on_max_change: ..)A current value bounded by another stat (health by max health).
MetaMetaTransient: scales one value, then resets (manifold:incoming_damage).

Resource fields:

FieldTypeRequiredDefaultDescription
maxstringyesThe stat that bounds it (manifold:stat key), not itself.
on_max_changeMaxChangenoKeepFractionWhat happens to the current value when the maximum changes.

MaxChange

What a resource does when its maximum changes.

VariantWrittenDescription
KeepFractionKeepFractionKeeps the same fraction of the maximum.
KeepValueKeepValueKeeps the value, clamped to the new maximum.

Rounding

Rounding after the clamp.

VariantWrittenDescription
NoneNoneNo rounding.
FloorFloorDown to a whole number.
NearestNearestTo the nearest whole number.

StatAudience

Who sees a stat’s value.

VariantWrittenDescription
ServerServerOnly the server.
OwnerOwnerThe server and the entity’s owner.
PartyPartyThe owner’s party too.
PublicPublicEvery client with the entity in scope.

StatUi

A stat’s player-facing text, as message keys.

A record: StatUi(..) or (..).

FieldTypeRequiredDefaultDescription
namestring or Noneno<mod>.stat.<id>.nameThe name’s message key.
descriptionstring or NonenononeThe description’s message key.
iconstring or NonenononeAn icon asset.

Value forms used here: number.