Skip to content

Bots check that they have a grenade throwing vantage point - #2074

Open
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-grenade-throw-check-vantage-first
Open

Bots check that they have a grenade throwing vantage point#2074
sunzenshen wants to merge 2 commits into
NeotokyoRebuild:masterfrom
sunzenshen:bot-grenade-throw-check-vantage-first

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

At the start of the grenade throwing behavior, bots check that they have a grenade throwing vantage point.
This prevents some jitter in behavior where bots swap a grenade into their hand and then immediately swap back to another weapon.

Toolchain

  • Windows MSVC VS2022

@sunzenshen sunzenshen added the Bots Related to bot players label Aug 17, 2026
@sunzenshen
sunzenshen requested a review from a team August 17, 2026 07:13
@AdamTadeusz

Copy link
Copy Markdown
Contributor
image

Got this message, never seen a box like this before.

Stack Trace:

 	server.dll!common_assert_to_message_box<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 388	C++
 	server.dll!common_assert<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 424	C++
>	server.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444	C++
 	server.dll!CUtlStack<CHandle<CBaseHL2MPCombatWeapon>,CUtlMemory<CHandle<CBaseHL2MPCombatWeapon>,int>>::Pop() Line 282	C++
 	server.dll!CNEOBot::PopRequiredWeapon() Line 1750	C++
 	server.dll!CNEOBotGrenadeThrow::OnEnd(CNEOBot * me, Action<CNEOBot> * nextAction) Line 519	C++
 	server.dll!Action<CNEOBot>::InvokeOnEnd(CNEOBot * me, Behavior<CNEOBot> * behavior, Action<CNEOBot> * nextAction) Line 1432	C++
 	server.dll!Action<CNEOBot>::ApplyResult(CNEOBot * me, Behavior<CNEOBot> * behavior, ActionResult<CNEOBot> result) Line 1660	C++
 	server.dll!Action<CNEOBot>::ApplyResult(CNEOBot * me, Behavior<CNEOBot> * behavior, ActionResult<CNEOBot> result) Line 1650	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Behavior<CNEOBot>::Update(CNEOBot * me, float interval) Line 258	C++
 	server.dll!CNEOBotIntention::Update() Line 2884	C++
 	server.dll!INextBot::Update() Line 133	C++
 	server.dll!NextBotPlayer<CNEO_Player>::Update() Line 1093	C++
 	server.dll!CNEOBot::Update() Line 860	C++
 	server.dll!NextBotPlayer<CNEO_Player>::PhysicsSimulate() Line 836	C++
 	server.dll!CNEOBot::PhysicsSimulate() Line 716	C++
 	server.dll!Physics_SimulateEntity(CBaseEntity * pEntity) Line 2019	C++
 	server.dll!Physics_RunThinkFunctions(bool simulating) Line 2075	C++
 	server.dll!CServerGameDLL::GameFrame(bool simulating) Line 1289	C++
 	[External Code]	

@AdamTadeusz

Copy link
Copy Markdown
Contributor
image

Got this message, never seen a box like this before.

Stack Trace:

 	server.dll!common_assert_to_message_box<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 388	C++
 	server.dll!common_assert<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 424	C++
>	server.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444	C++
 	server.dll!CUtlStack<CHandle<CBaseHL2MPCombatWeapon>,CUtlMemory<CHandle<CBaseHL2MPCombatWeapon>,int>>::Pop() Line 282	C++
 	server.dll!CNEOBot::PopRequiredWeapon() Line 1750	C++
 	server.dll!CNEOBotGrenadeThrow::OnEnd(CNEOBot * me, Action<CNEOBot> * nextAction) Line 519	C++
 	server.dll!Action<CNEOBot>::InvokeOnEnd(CNEOBot * me, Behavior<CNEOBot> * behavior, Action<CNEOBot> * nextAction) Line 1432	C++
 	server.dll!Action<CNEOBot>::ApplyResult(CNEOBot * me, Behavior<CNEOBot> * behavior, ActionResult<CNEOBot> result) Line 1660	C++
 	server.dll!Action<CNEOBot>::ApplyResult(CNEOBot * me, Behavior<CNEOBot> * behavior, ActionResult<CNEOBot> result) Line 1650	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Action<CNEOBot>::InvokeUpdate(CNEOBot * me, Behavior<CNEOBot> * behavior, float interval) Line 1379	C++
 	server.dll!Behavior<CNEOBot>::Update(CNEOBot * me, float interval) Line 258	C++
 	server.dll!CNEOBotIntention::Update() Line 2884	C++
 	server.dll!INextBot::Update() Line 133	C++
 	server.dll!NextBotPlayer<CNEO_Player>::Update() Line 1093	C++
 	server.dll!CNEOBot::Update() Line 860	C++
 	server.dll!NextBotPlayer<CNEO_Player>::PhysicsSimulate() Line 836	C++
 	server.dll!CNEOBot::PhysicsSimulate() Line 716	C++
 	server.dll!Physics_SimulateEntity(CBaseEntity * pEntity) Line 2019	C++
 	server.dll!Physics_RunThinkFunctions(bool simulating) Line 2075	C++
 	server.dll!CServerGameDLL::GameFrame(bool simulating) Line 1289	C++
 	[External Code]	

I remember the bot I was spectating wanted to throw a grenade but then changed their mind, i don't know if maybe this same bot tried to throw the grenade again and that caused the issue?

@sunzenshen
sunzenshen marked this pull request as draft August 17, 2026 16:32
@sunzenshen
sunzenshen removed the request for review from a team August 17, 2026 16:32
... before swapping their weapon to a grenade and before pulling the pin on a grenade.
@sunzenshen
sunzenshen force-pushed the bot-grenade-throw-check-vantage-first branch from ea3811e to 646be53 Compare August 29, 2026 10:07
@sunzenshen
sunzenshen marked this pull request as ready for review August 29, 2026 10:07
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Got this message, never seen a box like this before.

Seems like the push/pop of required weapon was uneven which was exacerbated by the earlier stop of the behavior. But this uneven push/pop also had a few preexisting cases that were rare to appear. I took some time to clean up the uneven balance of push/pop required weapon calls by wrapping them into obvious before/after functions (BeginThrowFocus/EndThrowFocus).

@sunzenshen
sunzenshen requested a review from a team August 29, 2026 10:11
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.

2 participants