Propagate area avoidance penalties to OnStuck/OnMoveToFailure through CNEOBotIntention inheritance chain#2025
Conversation
sunzenshen
left a comment
There was a problem hiding this comment.
The impetus for this review was that I was trying to figure out why CNEOBot ::OnStuck implementations were not always corresponding with the incrementing of area avoid penalties.
This implementation is based on the call chain that is started with CNEOBotIntention which is the first CNEO specific implementation that is dispatched from NextBotEventResponder::OnStuck(). The hope is that this is a more reliable central point to increment area avoidance penalties without having to replicate the logic elsewhere.
server.dll!CNEOBotIntention::OnStuck() Line 2885
at C:\Users\usr\ntre\neo\src\game\server\neo\bot\neo_bot.cpp(2885)
server.dll!INextBotEventResponder::OnStuck() Line 172
at C:\Users\usr\ntre\neo\src\game\server\NextBot\NextBotEventResponderInterface.h(172)
server.dll!ILocomotion::StuckMonitor() Line 508
at C:\Users\usr\ntre\neo\src\game\server\NextBot\NextBotLocomotionInterface.cpp(508)
server.dll!ILocomotion::Update() Line 62
at C:\Users\usr\ntre\neo\src\game\server\NextBot\NextBotLocomotionInterface.cpp(62)
server.dll!PlayerLocomotion::Update() Line 423
at C:\Users\usr\ntre\neo\src\game\server\NextBot\Player\NextBotPlayerLocomotion.cpp(423)
server.dll!CNEOBotLocomotion::Update() Line 18
at C:\Users\usr\ntre\neo\src\game\server\neo\bot\neo_bot_locomotion.cpp(18)
server.dll!INextBot::Update() Line 133
at C:\Users\usr\ntre\neo\src\game\server\NextBot\NextBotInterface.cpp(133)
server.dll!NextBotPlayer<CNEO_Player>::Update() Line 1093
at C:\Users\usr\ntre\neo\src\game\server\NextBot\Player\NextBotPlayer.h(1093)
server.dll!CNEOBot::Update() Line 860
at C:\Users\usr\ntre\neo\src\game\server\neo\bot\neo_bot.cpp(860)
server.dll!NextBotPlayer<CNEO_Player>::PhysicsSimulate() Line 836
at C:\Users\usr\ntre\neo\src\game\server\NextBot\Player\NextBotPlayer.h(836)
server.dll!CNEOBot::PhysicsSimulate() Line 716
at C:\Users\usr\ntre\neo\src\game\server\neo\bot\neo_bot.cpp(716)
server.dll!Physics_SimulateEntity(CBaseEntity * pEntity) Line 2019
at C:\Users\usr\ntre\neo\src\game\server\physics_main.cpp(2019)
server.dll!Physics_RunThinkFunctions(bool simulating) Line 2075
at C:\Users\usr\ntre\neo\src\game\server\physics_main.cpp(2075)
server.dll!CServerGameDLL::GameFrame(bool simulating) Line 1289
at C:\Users\usr\ntre\neo\src\game\server\gameinterface.cpp(1289)
| { | ||
| m_path.Invalidate(); | ||
| m_attackCoverArea = nullptr; | ||
| CNEOBotPathReservations()->IncrementAreaAvoidPenalty(me->GetLastKnownArea()->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat()); |
There was a problem hiding this comment.
The impetus for this review was that I was trying to figure out why CNEOBot ::OnStuck implementation were not incrementing area avoid penalties.
There was a problem hiding this comment.
The deferencing of me->GetLastKnownArea()->GetID() without checking the GetLastKnownArea() result also caused #2034, so this PR addresses that crash.
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
I moved this code into CNEOBotIntention
… CNEOBotIntention inheritance chain
to reduce potential false positives with the next planned area and nearest area (which may not relate to the blockage)
0a9aa59 to
8d8fb07
Compare
| { | ||
| CNEOBotPathReservations()->IncrementAreaAvoidPenalty( navArea->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() ); | ||
| } | ||
| else |
There was a problem hiding this comment.
I decided beyond this point to get rid of searching for the nearest nav area, as well as the next navarea path, to both save CPU cycles, but also it's possible those areas can be innocent so it's a bit too proactive to penalize those areas.
Description
Centralize incrementing of area avoid penalty through inheritance chain of CNEOBotIntention
Also fix GetLastKnownArea() nullptr dereference in Attack behavior
Toolchain
Linked Issues