Skip to content

Conversation

ShowinGrowin
Copy link

Description

Bots are intended to deathmatch when they don't understand the current gamemode. This feature was eventually broken when the cvar tf_bot_offense_must_push_time was added to the game. This check is only relevant in specific gamemodes.

Since only specific gamemodes account for this logic, it causes them to not go into their "deathmatch" mode when they're supposed to. I added a check for said gamemodes so they will still use "seek and destroy" logic if there is no other supported gamemode logic to go by.

Fix bots seek and destroy AI.
@megascatterbomb
Copy link

I think you forgot to delete the original code just before the part you added. As currently written there'll be no change in behaviour as the condition on L86 will pass before the identical condition on L96 (that you wrapped with additional checks) is ever evaluated.

image

fixed original code remaining
@ShowinGrowin
Copy link
Author

I think you forgot to delete the original code just before the part you added. As currently written there'll be no change in behaviour as the condition on L86 will pass before the identical condition on L96 (that you wrapped with additional checks) is ever evaluated.

image

Yeah my bad. I originally had it in the master fork but decided to move it to a branch and ended up accidentally keeping a copy of the original code. Now it's fixed.

@megascatterbomb
Copy link

megascatterbomb commented Mar 2, 2025

I think the bug you're trying to fix stems from tf_bot.cpp:

image

If none of the expected conditions are met then the function returns 0.0, which tricks other parts of the code into thinking the round is about to end at that instant.

Since we need to account for overtime I think changing the condition to exclude 0.0 is unreliable. The best fix imo would be to change that final return statement to return a really big number, say FLT_MAX. The function isn't used for anything other than comparing to cvars so using FLT_MAX here should be safe.

This will also fix any other bugs caused by other references to GetTimeLeftToCapture(). Keep your check in place, it is reasonable since we don't want to exit the seek and destroy state unnecessarily.

Thanks/credit to megascatterbomb for the suggestion.
@ShowinGrowin
Copy link
Author

Tested it out and it worked. I've added that change alongside the original one as well. Thanks!

@megascatterbomb
Copy link

Tested myself, LGTM!

Bitl added a commit to BitlDevelopmentStudios/source-sdk-2013-bds-base that referenced this pull request Mar 8, 2025
@Ashetf2
Copy link

Ashetf2 commented Mar 11, 2025

How sure how it is supposed to work but it doesn't in my end

Desktop.2025.03.11.-.15.13.51.04.DVR.mp4

@ShowinGrowin
Copy link
Author

ShowinGrowin commented Mar 12, 2025

The problem with Payload Race is bots think the gamemode is payload. They aren't really set up to properly understand and support two payload carts though. You can use "NB_DEBUG BEHAVIOR" to see what AI bots are currently using.

The seek and destroy AI will occur when the bots have literally no game logic to use. Which should work on most unsupported maps/gamemodes. There are a few exceptions like CTF and PLR though. In these they somewhat understand the gamemode. I think these would preferably be fixed with actual real support for these gamemodes (especially for PLR since they already understand payload) instead of using their deathmath AI.

Blixibon added a commit to Blixibon/source-sdk-2013 that referenced this pull request Sep 11, 2025
Blixibon added a commit to Blixibon/source-sdk-2013 that referenced this pull request Sep 11, 2025
Blixibon added a commit to Blixibon/source-sdk-2013 that referenced this pull request Sep 11, 2025
Blixibon added a commit to mapbase-source/source-sdk-2013 that referenced this pull request Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants