Monster behavior

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fizzix
    Prophet
    • Aug 2009
    • 3025

    Monster behavior

    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...
  • Rowan
    Adept
    • Sep 2014
    • 139

    #2
    Originally posted by fizzix
    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.
    Yeah, for a while I've thought it was a little unrealistic that every awake monster seems to have auto-ESP (and yet often can't figure out an obvious path to @).

    I think it'd be kind of cool to see monsters wandering around once they wake up, or actively searching for the player, etc. I wonder, though- do you think taking away the monsters' auto-ESP might make the game too easy? E.g. if hounds didn't know to stay 1-2 steps outside line-of-sight, most would pose zero threat (sure, hounds can probably "smell" the player, but it's just an example).

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9637

      #3
      Originally posted by fizzix
      II should probably find out what Nick has planned for this area too...
      Considerable similarity to what you've proposed, really. The main ingredients I have in mind are:
      • At least one state between sleep and chasing - I've been thinking of it as awake, but not aware
      • An improvement of tracking by sound and by smell, with different monsters being differently good at this. Sound should help wake monsters, and both sound and smell should attract the attention of awake monsters
      • Player stealth should relate to sound propagation
      • Maybe some monsters should track by "sensing life force", so always be aware of the player inside a given radius
      • Groups - I had a rough implementation of groups, group leaders and random targets in FA, and there is now unused code for monster targets in V


      Some bits of this will be easier than others.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • AnonymousHero
        Veteran
        • Jun 2007
        • 1393

        #4
        Don't have any detailed comments, but I think this sounds like a huge improvement.

        Comment

        • AnonymousHero
          Veteran
          • Jun 2007
          • 1393

          #5
          Originally posted by Nick
          [*]At least one state between sleep and chasing - I've been thinking of it as awake, but not aware
          "Wary"? (I mean the monsters must sense some danger too, right?)

          Comment

          Working...
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎