Stupid monster behavior when facing damaging terrain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2987

    Stupid monster behavior when facing damaging terrain

    Let's say you're in a corridor with a monster than can breathe fire powerfully and another monster that doesn't resist fire but is powerful enough to tank one breath. The monster breathes fire and lays down a lava tile like this (marked as '*'):

    Code:
    #x#
    #.#########
    #..@...*M.D
    ###########
    For this case, the code will make M move towards the player and then since the tile is damaging, try to put it to safety, which is out of sight of the player (marked as 'x' in the corridor behind). M will then continue properly as if there was no damaging tile.

    Now let's look at the opposite case:

    Code:
    #x#
    #.#########
    #..D..M*..@
    ###########
    The same code will trigger, so when reaching the damaging tile, M will try to run to the "safe" spot which, being behind it, will make it move away from the player, going back to its previous location. We enter then an endless loop where M moves east to the damaging tile then west then east again.

    This is absurd. Once on the damaging tile, the first check that should be made is "can M move forward normally?" If so there's no reason to force the monster to flee, it should simply continue forward.

    EDIT: this doesn't happen in V, as "monster hates grid" and "monster is damaged by terrain" are both identical; to properly fix a potential problem, just replace code for monster_taking_terrain_damage() by

    Code:
    bool monster_taking_terrain_damage(struct monster *mon)
    {
    	return monster_hates_grid(cave, mon, mon->grid);
    }
    And this also removes duplicate code...
    Last edited by PowerWyrm; September 10, 2020, 10:57.
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
  • PowerWyrm
    Prophet
    • Apr 2008
    • 2987

    #2
    Another stupid case:

    Code:
    #####
    .....
    M.#.@
    .....
    #####
    When you have something unpassable like a wall or door, M easily uses the openings to come to you.

    Code:
    #####
    .....
    M.*.@
    .....
    #####
    If the blockade is some damaging terrain, M simply stays stuck behind it and doesn't even try to look for the openings.

    EDIT: in get_move_advance(), player is chosen as target if player is in LOS of the monster; a check should be made vs damaging terrain to use an alternate route if it's the case.
    Last edited by PowerWyrm; September 10, 2020, 11:00.
    PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

    Comment

    • Egavactip
      Swordsman
      • Mar 2012
      • 442

      #3
      In the game I just finished I was surprised to see even some of the most powerful uniques afraid to step into a single square of lava in order to get to me.

      Comment

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