Monsters
Home · The engine in ten minutes · MonsterRuntime ·
MonsterMode
In brief
Monsters do not see the party: they remember a destination block. When the party comes close enough and in front of a monster, the monster records the party's current block and starts pursuing it. If the party slips away, the monster keeps walking toward the block where it last noticed it, then starts wandering. Once in pursuit, a monster tries a ranged attack, then a melee attack, and moves only if it could do neither. A monster that has been attacked never forgets it: whenever it stops pursuing, it sets off again toward the party. Monsters open some doors, share a block according to their size (inferred), and act on their group's update; the game has no rounds.
Each monster's state is held in a
MonsterRuntime slot, initialized from
the level's INF data; its current behavior is its
MonsterMode.
How a monster acts
Monsters are updated in groups, each run by its own
timed update at an interval the level sets — 15, 25
or 35 ticks in the original levels. A monster's group is two times its INF
unit, plus one for an odd slot, so the monsters of a unit are split between
two updates with the same interval (cadence).
For each monster of the group, in slot order:1
- A monster with no hit points left, or turned to stone, is skipped.
- A monster that a neighbor on its block has just turned (step 7) skips this one update.
- The monster may notice the party.
- A provoked monster that is not pursuing goes back to pursuit.
- The routine of its mode runs.
- Its walking frame alternates, except in
MONSTER_MODE_WAIT,MONSTER_MODE_DELAYEDandMONSTER_MODE_PEACEFUL. - When its type's occupancy class is 1 — the class whose monsters share a block in pairs — every other monster on its block takes its facing; each one that turns skips its next update.
Step 7 also runs for the monsters of the other groups, at every group's update.
In pursuit (MONSTER_MODE_PURSUE), the routine follows this order:2
The block ahead is the neighboring block in the monster's facing. A type
with MONSTER_CAP_ATTACKS_ANY_SIDE uses instead the neighbor toward the
party when the party lies in one of the four straight directions; the
melee attack checks the same block. The second melee
attempt depends on MONSTER_CAP_POST_MOVE_ACTION in the monster type's
capabilities. Movement is described
under moving toward the destination; the
other modes — patrolling, waiting, wandering, timed inactivity — on the
MonsterMode page, and what makes a monster
change mode in its own page.
The pages of this chapter
| Page | What it covers |
|---|---|
| Noticing the party | Distance, facing and the destination block; losing the party. |
| Moving toward the destination | The direction tried first, the order of tries, fleeing. |
| Modes and provocation | Reacting to damage, changing mode, the state that lasts. |
| Obstacles and other monsters | Walls and doors, sharing a block. |
| Ranged attacks | Weapons, the wait between attacks, monster spells. |
| Melee attacks | The attack sequence, effects on characters, attack timing. |
| When a monster dies | Explosions, items, experience, the final opponent. |
| Bestiary | The 29 monster images compared, who has which ability, and one sheet per monster: where it lives, its values, abilities and other values. |
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references.