Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the pull request
Xeno AI keeps a cache of valid targets discovered that tick. Each hive & caste combo has its own cache.
Each individual xeno still does ranging per target but can distribute the cost of testing allyship and
ai_can_target
and such.Explain why it's good for the game
Should reduce duplicated work per-AI on finding targets and hopefully reduce AI's performance overhead.
Testing Photographs and Procedure
Screenshots & Videos
Master:
PR:
There's a lot of moving parts to AI performance. The number of possible targets, the number of agents trying to get to those targets, the difficulty of the terrain, the distance they're trying to move...
All of this makes it hard to tell if the performance in two different games is actually comparible.
What I can tell is that the difference in
get_target
is extreme. Before, ~70k calls cost ~35 total seconds. After, ~70k cost ~5 seconds. Its cost is dependent on the number of potential targets, which should have been in the same rough ballpark each time: standard USCM platoon in Master, UPP platoon in PR.carbon/proc/ai_can_target
: before 2.9 million calls @ ~25 total seconds, after 250k calls @ 3 total secondsDependent on number of targets. In same ballpark both times.
process_ai
: before 90k calls @ 40 total seconds, after 110k calls @ 28 total secondsDependent on number of AI. Hard to judge average xenocount, but both platoons were under repeated attack.
Changelog
🆑
code: AI caches valid targets for better performance
/:cl: