Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

data/locomotion/

A locomotion profile: how a creature moves and how pathfinding plans for it. It names a locomotion class (whose navigation data the paths use), the body size, speeds, step, jump and drop limits, the turn rate, and extra costs per kind of terrain or surface block, so a boar avoids water and never walks through fire. An archetype’s manifold-nav:locomotion component names its profile. A body larger than its class fails to load; a profile stricter than its class loads with a warning, because its reachability answers become searches. The blocks surface_malus names must exist (DATA010). Loaded by the server only.

Registrymanifold-nav:locomotion
Filesdata/locomotion/*.ron, *.update.ron, *.final.ron
Sidesserver: only the server loads it
Readsnothing
ContractNavigation, data stage

Entry

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

FieldTypeRequiredDefaultDescription
idstringyesThe profile’s key, <mod-id>:<name>.
classstringyesThe locomotion class: manifold:walker_small (under 1 × 1 blocks), manifold:walker (1 × 2), manifold:walker_large (2 × 3, no gap jumps or climbing), manifold:swimmer (1 × 1, only in water) or manifold:flyer (1 × 2, in free air).
bodyBodySizeyesThe body, which must fit the class.
speedSpeedsyesSpeeds, m/s.
stepf32no0.5How high it steps up without jumping, in metres.
jumpf32no1.1The jump’s apex, in metres; the jump speed follows.
max_dropu8no3How many blocks a planned drop may fall.
gap_jumpGapJumpnoAutoHow wide a gap it jumps.
turn_rate_deg_per_sf32no360.0The fastest it turns, degrees per second. Abilities may only turn it slower.
arrive_radiusf32no1.0Within this many metres of its goal it slows to a stop.
strafeboolnofalsetrue for a biped that moves in any direction; false for a quadruped that moves the way it faces.
can_swimboolnotrueWhether it may swim. The swimmer class needs it.
can_flyboolnofalseWhether it flies: true exactly when the class is manifold:flyer. A flyer cruises at speed.walk (sprint when sprinting).
can_climbboolnofalseWhether it climbs ladders and other climbable blocks. It needs a climbing class (manifold:walker_small or manifold:walker) and a positive speed.climb.
can_open_doorsboolnofalseWhether it opens closed doors, fence gates and trapdoors on its path. Without it, a closed door is impassable.
digDigProfile or NonenononeDigging through blocks (a later phase): a profile with it makes an unreachable answer a search instead.
malusmap of PathType to malusnononeExtra path cost per path type, or Impassable. A cost on a hazard its class avoids (DamageFire) makes it passable.
drop_malusDropMalusno3 blocks free, then 12 per blockThe cost of planned drops.
surface_maluslist of SurfaceMalusnononeExtra costs for cells by the block underfoot: a standing cell takes its support’s block, a water cell its fluid’s.
searchSearchSettingsnoa follow range of 32 blocksPath search limits.
avoidanceAvoidancenoSeparationHow it keeps apart from others.
flockFlockWeightsnoseparation 1, alignment 0.3, cohesion 0.2 within 4 metresThe flocking weights, used with avoidance: Flock.
knockbackKnockbackSettingsno8 ticksWhat knockback does to its movement.

Example

From tools/test-mods/guide-creature/data/locomotion/razorback.ron:

LocomotionProfile(
    id: "guide-creature:razorback",
    class: "manifold:walker_small",
    body: (width: 0.9, height: 0.9),
    speed: (walk: 3.0, sprint: 6.5, swim: 1.2),
    turn_rate_deg_per_s: 600.0,
    malus: {
        Water: 12,
        DangerFire: 8,
    },
)

Types

BodySize

A body’s size, in metres.

A record: BodySize(..) or (..).

FieldTypeRequiredDefaultDescription
widthf32yesThe width.
heightf32yesThe height.

Speeds

Speeds, m/s.

A record: Speeds(..) or (..).

FieldTypeRequiredDefaultDescription
walkf32yesWalking, above 0.
sprintf32no0Sprinting.
swimf32no0Swimming.
climbf32no0Climbing, above 0 with can_climb.

GapJump

How wide a gap a profile jumps.

VariantWrittenDescription
AutoAutoFrom the walk speed and jump: floor(walk · 2v / g − 0.5) blocks.
BlocksBlocks(u8)This many blocks.

DigProfile

Digging through blocks.

A record: DigProfile(..) or (..).

FieldTypeRequiredDefaultDescription
hardness_limitf32yesThe hardest block it digs.
seconds_per_hardnessf32yesSeconds per point of hardness.

PathType

A kind of cell, as pathfinding classifies it for a body.

VariantWrittenDescription
BlockedBlockedThe body does not fit.
OpenOpenIt fits, but nothing supports it.
WalkableWalkableIt fits and is supported.
WaterShallowWaterShallowWalkable, with shallow fluid.
WaterWaterThe body would swim.
HazardFluidHazardFluidA fluid that cannot be swum, or that hurts.
DangerFireDangerFireNext to fire.
DamageFireDamageFireIn fire.
DangerOtherDangerOtherNext to another hazard.
DamageOtherDamageOtherIn another hazard.
DoorClosedDoorClosedA closed door.
DoorOpenDoorOpenAn open door.
ClimbableClimbableClimbable, without support: only climbing profiles enter it.
SlowSlowSlow ground.
UnloadedUnloadedNot loaded; never stored, so a malus here does nothing.

DropMalus

The cost of planned drops.

A record: DropMalus(..) or (..).

FieldTypeRequiredDefaultDescription
free_blocksu8yesBlocks a drop may fall at no extra cost.
per_blocku16yesThe cost per block beyond them.

SurfaceMalus

An extra cost for cells over one kind of block.

A record: SurfaceMalus(..) or (..).

FieldTypeRequiredDefaultDescription
maskstringyesThe block (<mod-id>:<name>), until block masks replace block names. An unknown block fails the data stage (DATA010).
costi16yesThe extra cost of entering such a cell; negative to prefer it (a road). Every step still costs at least 4.

SearchSettings

Path search limits.

A record: SearchSettings(..) or (..).

FieldTypeRequiredDefaultDescription
follow_rangeu16yesThe farthest it plans to follow a target, in blocks.
max_nodesu32 or Nonenofollow_range × 16The most nodes one search expands, 16 to 4096.

Avoidance

How an agent keeps apart from others. Every agent separates; the others add to it.

VariantWrittenDescription
SeparationSeparationPushes away from neighbours.
OrcaOrcaVelocity obstacles (ORCA) in a dense fight: at full AI detail, within 16 blocks of a player, with at least 4 others within 3 blocks. Separation otherwise.
FlockFlockSeparation, alignment and cohesion with agents of the same profile (pets following an owner, herds, birds), weighted by flock.

FlockWeights

Flocking weights, each a share of the agent’s speed.

A record: FlockWeights(..) or (..).

FieldTypeRequiredDefaultDescription
separationf32no1.0Push away from neighbours.
alignmentf32no0.3Match the flockmates’ mean velocity.
cohesionf32no0.2Steer toward the flockmates’ centre.
radiusf32no4.0Flockmates within this many metres count.

KnockbackSettings

What knockback does to movement.

A record: KnockbackSettings(..) or (..).

FieldTypeRequiredDefaultDescription
lock_ticksu16yesTicks without steering after a knock.

Value forms used here: malus.