Comabt AI problem

Everything about development and the OpenMW source code.
Post Reply
ervinkeel2001
Posts: 2
Joined: 12 Oct 2020, 16:32
Gitlab profile: https://gitlab.com/markpundsack

Comabt AI problem

Post by ervinkeel2001 »

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

Code: Select all

player->positioncell 175 2376 903 -28 "Arkngthand, Hall of Centrifuge" 
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): download gimp

Code: Select all

if (getDistanceMinusHalfExtents(actor, enemy, true) <= 0.0f)
            return false;
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?
Last edited by ervinkeel2001 on 24 Oct 2020, 20:50, edited 1 time in total.
User avatar
heilkitty
Posts: 158
Joined: 11 Aug 2011, 07:57
Location: Vivec City, MW
Contact:

Re: Comabt AI problem

Post by heilkitty »

Let me live! You will be disgraced for this! ?
My guess, it replicates original Morrowind behavior.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Comabt AI problem

Post by AnyOldName3 »

If you're a new user and your posts still need manual approval, it's best not to edit posts. The edit still requires manual approval, but is less likely to get seen than a fresh reply when a moderator visits the forums.
Post Reply