Core/Movement: Fix isInAccessiblePlaceFor calculations (and thereby evading behavior of npcs) #10979

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
8 participants
Contributor

Elron103 commented Oct 1, 2013

Description:
The function Unit::isInAccessiblePlaceFor currently does not use mmaps. This commit changes it and thereby some mechanics (such as evading behaviour for creatures if target is not in an accessible place) are also improved.

Environment:
Tested it with
TC: 895a23d
DB: TDB 52

Related issue:
#9206

Contributor

Subv commented Oct 1, 2013

It's been a few months, and I still love your Alf avatar.

Seems to me like this would allow them to never evade. On official when you get to a spot they can't reach you they evade and reset.

By always returning TRUE you're allowing them to path into or under objects and continue attacking you when they shouldn't.

Owner

Elron103 replied Oct 5, 2013

In this case MMaps are disabled for that map, thus there should not be any pathing at all there. ;) This one here is just for "backwards"-compatibility, when not using MMaps. So creatures will just check for matching InhabitTypes to their targets in that case, as it was before MMaps, and move straight towards their targets then.

But indeed, evading stuff and other MMaps-related calculations are still a big TODO in that context. But this should be more related to MovementGenerators and / or creature behavior than to that change here.

I suppose that makes sense.

I was thinking in terms of jumping onto a ledge out of reach and having this function say "yep, it's OK to path there because you walk and mmaps are disabled" and then having the NPC disappear into the wall.

Contributor

Zedron commented Mar 15, 2014

nice idea but it's not blizzlike, since isInAccessiblePlaceFor is called in _setTargetLocation of targetedmovementgenerator, it will cause the creature to not even attempt to path to the target.
in official, the creature will path to the nearest accessible point, and from there if they can't attack the target then after a few seconds they'll evade.

Edit: nevermind you're right, this is blizzlike for hostile creatures atleast (pets untested). there's just implementation missing elsewhere for the few secondds of wait time to evade.

Member

joschiwald commented Apr 1, 2014

take a look at TargetedMovementGeneratorMedium::IsReachable()
maybe it can help you

Contributor

Zedron commented Apr 25, 2014

update: this is blizzlike for pets & for creatures, however it would be nice if there was a more performance friendly way of doing this, since generating a path every time you want to see if the target is in an accessible place is not very efficient

@Shauren Shauren closed this Jun 23, 2014

@Aokromes Aokromes reopened this Jun 23, 2014

Member

jackpoz commented Aug 8, 2014

could you please profile your changes and compare them with the old code ? just to get an idea about what's the cost of this feature

Member

jackpoz commented Aug 24, 2014

Please profile these changes and add the result to this PR.
Closing it in the meantime since it will not be merged with the current unknown state of performance.

@jackpoz jackpoz closed this Aug 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment