Skip to content

Propagate area avoidance penalties to OnStuck/OnMoveToFailure through CNEOBotIntention inheritance chain#2025

Open
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-onstuck-penalty-intention-interface
Open

Propagate area avoidance penalties to OnStuck/OnMoveToFailure through CNEOBotIntention inheritance chain#2025
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-onstuck-penalty-intention-interface

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

Centralize incrementing of area avoid penalty through inheritance chain of CNEOBotIntention

Also fix GetLastKnownArea() nullptr dereference in Attack behavior

Toolchain

  • Windows MSVC VS2022

Linked Issues

@sunzenshen sunzenshen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impetus for this review was that I was trying to figure out why CNEOBot ::OnStuck implementation were not incrementing area avoid penalties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deferencing of me->GetLastKnownArea()->GetID() without checking the GetLastKnownArea() result also caused #2034, so this PR addresses that crash.

}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this code into CNEOBotIntention

@sunzenshen
sunzenshen requested a review from a team July 17, 2026 04:42
@sunzenshen sunzenshen added the Bots Related to bot players label Jul 17, 2026
to reduce potential false positives with the next planned area and nearest area (which may not relate to the blockage)
@sunzenshen
sunzenshen force-pushed the bot-onstuck-penalty-intention-interface branch from 0a9aa59 to 8d8fb07 Compare July 25, 2026 21:31
{
CNEOBotPathReservations()->IncrementAreaAvoidPenalty( navArea->GetID(), neo_bot_path_reservation_onstuck_penalty.GetFloat() );
}
else

@sunzenshen sunzenshen Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DESTROYGIRL
DESTROYGIRL self-requested a review July 25, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bots Related to bot players

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nav related crash on ntre_apparatus_dm_rc2

1 participant