Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0009759 [DCSS] Bug Report minor always 2015-06-07 19:57 2015-06-16 19:43
Reporter coledot View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Branch 0.16 ancient branch
Summary 0009759: friendly followers will walk into hostile clouds created by other friendlies
Description Playing a HOFi^Beogh on 0.16.1, plenty of orcish friendly followers. I use a lamp of fire & summon two fire elementals, also friendly. The elementals spawn fire clouds, yet my non-fire-resistant orcs will ignorantly waltz into them, then burn and die.
It's a bit annoying that the player's followers don't have the same self-preservation instincts as their leader. At least Beogh didn't place me under penance as a result. :)
Additional Information
Tags No tags attached.
Attached Files

- Relationships
related to 0002980new Monsters happily wander into dangerous clouds 

-  Notes
(0029148)
PleasingFungus (administrator)
2015-06-07 21:17

This has nothing to do with orcs or friendliness, I think. Monsters will walk into clouds if they think they have enough HP to survive for a few turns, which e.g. high-level orcish followers (knights, warlords) do. The fact that they end up being in the flame clouds for more than a few turns is mainly the result of short-sightedness on their part. (:

Still not ideal, but I'm not sure there's anything to be done from a dev perspective; players may just have to be careful? Monsters being dumb is not a bug, in general...
(0029182)
coledot (reporter)
2015-06-16 06:42

I took a quick look at the pathfinding code and found the method mons_travel_cost(). It appears there's no check at all for clouds? I only see terrain & trap-related checks. Could we add something like the following to help intelligent monsters avoid damaging clouds? Pseudocode:

# in mons_travel_cost, between the trap check & return
if monster.intelligent():
    if (cloud_exists_at(pos) && mons.vulnerable_to(cloud_type_at(pos)):
        return 2;

I'd be willing to code this up if it sounds like a reasonable change.
(0029183)
PleasingFungus (administrator)
2015-06-16 18:26

For reference, the existing monster cloud logic is cloud.cc:mons_avoids_cloud(), mainly called from mon-act.cc:mon_can_move_to_pos(). It looks like this is used considerably after the pathfinding code you were looking at; the monster chooses a target destination & a path to it, and then, on each move, uses this logic to decide whether or not it can actually use the tiles with clouds on them.

That's my impression, anyway; certainly this logic is used, I'm just not sure how it interacts with the mon-pathfind stuff.
(0029184)
coledot (reporter)
2015-06-16 19:43
edited on: 2015-06-16 19:45

Cool, thanks for the pointer to mons_avoids_cloud(). I took a closer look at the cloud avoidance logic and found a couple of issues with one particular line:

const bool hp_ok = mons->hit_points >= hp_threshold;

hp_threshold appears to be an expected amount of damage that the monster can receive from a cloud each turn. This means that a monster could enter a cloud and potentially die the next turn! This is not ideal for intelligent monsters; I think they should have a larger margin of safety for entering clouds. The check should also be > w/o = for similar reasons: what monster would enter a cloud that could just barely kill it?

I tested the following in wizard mode & it seems to work pretty well. Do you think this is a reasonable change?

// intelligent monsters want a larger margin of safety
int safety_mult = (mons_intel(mons) > I_ANIMAL) ? 2 : 1;
// dare we risk the damage?
const bool hp_ok = mons->hit_points > safety_mult * hp_threshold;


- Issue History
Date Modified Username Field Change
2015-06-07 19:57 coledot New Issue
2015-06-07 21:17 PleasingFungus Note Added: 0029148
2015-06-16 06:42 coledot Note Added: 0029182
2015-06-16 18:26 PleasingFungus Note Added: 0029183
2015-06-16 19:43 coledot Note Added: 0029184
2015-06-16 19:45 coledot Note Edited: 0029184
2015-06-16 20:25 PleasingFungus Relationship added related to 0002980


Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker