Combat AI issue
Posted: 08 Apr 2019, 03:49
So I was snooping through Arkngthand today when I noticed that enemy NPCs were getting into an endless loop of combat/no combat running in and out of my line of sight. To reproduce run command stay put, and wait for someone to notice you. (Interestingly this issue doesn't show up on Debug builds due to slower execution therefore fewer AI calls)
I have tracked down the issue to the MWMechanics::canFight function in aicombataction.cpp, specifically this bit (lines 459-460 on my current Git mirror):
The result is that enemies far below you at a steep angle will stop fighting because getDistanceMinusHalfExtents here calculates Euclidean distance minus vertical distance. Can anyone say as to why this function is used to calculate whether combat is feasible? MiroslavR, perhaps you could bring some light?
Code: Select all
player->positioncell 175 2376 903 -28 "Arkngthand, Hall of Centrifuge"
I have tracked down the issue to the MWMechanics::canFight function in aicombataction.cpp, specifically this bit (lines 459-460 on my current Git mirror):
Code: Select all
if (getDistanceMinusHalfExtents(actor, enemy, true) <= 0.0f)
return false;