If you're like me, you are probably a bit unsatisfied with the why Angband (and frankly most roguelikes that aren't Sil) handle monster movement and behavior. I've started poking around at the code and thought I'd throw up some ideas with what I've been thinking of. The current monster states are:
Asleep: The monster has a sleep counter which gets decreased according to player movement.
Awake: All awake monsters will path to the current player location if they are ble to.
Afraid: The monster runs away from the player, but occasionally casts spells/breathes etc.
Status modifiers: Confusion, stun.
Once awake a monster will always path to the player. It will also never go back to sleep accept by magical means. I recommend the following behavior.
We have two intermediate states between Asleep and the current awake state which I call "Engaged". These look like.
Asleep: Same as before
Awake: Monster is awake, it will wander around the dungeon (possibly heading to a target location). It has a counter that causes the monster to sleep again when it reaches 0.
Alert: Anything that wakes up the monster, or any stimulus while it's awake moves it into alert. Here the monster doesn't necessarily know where the player is, but is actively looking for it. This might mean tracking a known previous location, or having a "perception" chance of knowing the player's current location. An alert monster will go to engaged if the player is ever in LoS. It will slip to awake if it's gone long enough without any new information about the player.
Engaged: This is the current awake state. The monster knows where the player is (most likely it can see the player) and is going to that location, casting spells, doing melee attacks, whatever. If the player leaves LoS (or telepathy region for powerful monsters) then it immediately moves into Alert.
We could probably use a single value, the current alertness, to determine how quickly monsters move between phases. An always alert monster (hound) will never drop below alert. Other monsters will go to sleep much sooner after the player leaves.
Having wandering monsters is tricky. For solitary monsters it's fairly easy, for pack monsters it's a bit harder. I'm hoping giving all the monsters in a pack the same target will keep the pack together, but that means we need some extra information about whether the monster is in a group, and what group that is.
All I've done so far is some maintenance work renaming some poor flags... I should probably find out what Nick has planned for this area too...
Asleep: The monster has a sleep counter which gets decreased according to player movement.
Awake: All awake monsters will path to the current player location if they are ble to.
Afraid: The monster runs away from the player, but occasionally casts spells/breathes etc.
Status modifiers: Confusion, stun.
Once awake a monster will always path to the player. It will also never go back to sleep accept by magical means. I recommend the following behavior.
We have two intermediate states between Asleep and the current awake state which I call "Engaged". These look like.
Asleep: Same as before
Awake: Monster is awake, it will wander around the dungeon (possibly heading to a target location). It has a counter that causes the monster to sleep again when it reaches 0.
Alert: Anything that wakes up the monster, or any stimulus while it's awake moves it into alert. Here the monster doesn't necessarily know where the player is, but is actively looking for it. This might mean tracking a known previous location, or having a "perception" chance of knowing the player's current location. An alert monster will go to engaged if the player is ever in LoS. It will slip to awake if it's gone long enough without any new information about the player.
Engaged: This is the current awake state. The monster knows where the player is (most likely it can see the player) and is going to that location, casting spells, doing melee attacks, whatever. If the player leaves LoS (or telepathy region for powerful monsters) then it immediately moves into Alert.
We could probably use a single value, the current alertness, to determine how quickly monsters move between phases. An always alert monster (hound) will never drop below alert. Other monsters will go to sleep much sooner after the player leaves.
Having wandering monsters is tricky. For solitary monsters it's fairly easy, for pack monsters it's a bit harder. I'm hoping giving all the monsters in a pack the same target will keep the pack together, but that means we need some extra information about whether the monster is in a group, and what group that is.
All I've done so far is some maintenance work renaming some poor flags... I should probably find out what Nick has planned for this area too...
Comment