Skip to content
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

AI valid target cache #394

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Conversation

Doubleumc
Copy link
Contributor

@Doubleumc Doubleumc commented Aug 20, 2024

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:
image
image

PR:
image
image

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 seconds
Dependent on number of targets. In same ballpark both times.

process_ai: before 90k calls @ 40 total seconds, after 110k calls @ 28 total seconds
Dependent 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:

@Doubleumc Doubleumc added needs tested testmerge this to see what breaks do not merge labels Aug 20, 2024
@Doubleumc Doubleumc removed do not merge needs tested testmerge this to see what breaks labels Aug 27, 2024
@Doubleumc Doubleumc merged commit fc98a09 into cmss13-devs:master Aug 28, 2024
36 checks passed
@Doubleumc Doubleumc deleted the AI-target-cache branch August 28, 2024 18:43
cm13-github added a commit that referenced this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant