-
Notifications
You must be signed in to change notification settings - Fork 20
NeoNextBots shoot at visible parts of other entities #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NeoNextBots shoot at visible parts of other entities #1248
Conversation
sunzenshen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if any of these recommendations don't make sense for the context.
sunzenshen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better in bot matches now. The way to check this behavior is to load up nt_bullet and verify that the bots don't try to shoot through the seats of the train when they see an enemy behind the obstacle.
|
This can be changed to give headshot aiming a higher precedence. Somewhere down the line when there's ability to customize bots can be used to differentiate "experts" and "normal" bots for example and add more logics like weapon type and distance. diff --git a/src/game/server/NextBot/NextBotVisionInterface.cpp b/src/game/server/NextBot/NextBotVisionInterface.cpp
index 5b9474fc..d316e072 100644
--- a/src/game/server/NextBot/NextBotVisionInterface.cpp
+++ b/src/game/server/NextBot/NextBotVisionInterface.cpp
@@ -773,6 +773,18 @@ bool IVision::IsLineOfSightClearToEntity( const CBaseEntity *subject, Vector *vi
trace_t result;
NextBotTraceFilterIgnoreActors filter( subject, COLLISION_GROUP_NONE );
+#ifdef NEO
+ UTIL_TraceLine( GetBot()->GetBodyInterface()->GetEyePosition(), subject->EyePosition(), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &filter, &result );
+ if ( result.DidHit() )
+ {
+ UTIL_TraceLine( GetBot()->GetBodyInterface()->GetEyePosition(), subject->WorldSpaceCenter(), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &filter, &result );
+
+ if ( result.DidHit() )
+ {
+ UTIL_TraceLine( GetBot()->GetBodyInterface()->GetEyePosition(), subject->GetAbsOrigin(), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &filter, &result );
+ }
+ }
+#else
UTIL_TraceLine( GetBot()->GetBodyInterface()->GetEyePosition(), subject->WorldSpaceCenter(), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &filter, &result );
if ( result.DidHit() )
{
@@ -783,6 +795,7 @@ bool IVision::IsLineOfSightClearToEntity( const CBaseEntity *subject, Vector *vi
UTIL_TraceLine( GetBot()->GetBodyInterface()->GetEyePosition(), subject->GetAbsOrigin(), MASK_BLOCKLOS_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE, &filter, &result );
}
}
+#endif
if ( visibleSpot )
{ |
I think shooting center mass should be the default? |
Regardless of bot difficulty even? Headshots been fairly effective I think at least hard/expert bots should aim more for the head. |
sunzenshen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious to know how 4e44af9 would affect the behavior of this PR, since there didn't seem to be a merge conflict.
Locally I rebased this branch on top of upstream/master e80e9b0 and observed some bot matches. Overall the behavior seems smooth, though I'm not sure if there's any redundancies in routines now. Up to you if you'd like to sanity test your expected behavior based on top of the latest master branch.
sunzenshen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loaded ntre_bullet and verified that bots now/still shoot over the train seats instead of previously trying to shoot through the seats all the time.
Description
Previously the bots would always shoot center mass, but IsLineOfSightClearToEntity checks center mass, eye pos and origin. This pr adds a map to NextBotVisionInterface that stores the ideal position for the bot to aim at when shooting at entities.