-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 Reachable system #1342
Merged
Merged
AI Reachable system #1342
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Like the first third of a hierarchical pathfinder. Previously it was Grid -> Chunks -> Nodes Now there's also Grid -> Chunks -> Regions -> Nodes The reason for this is it's faster to traverse regions rather than nodes because regions are made up of tiles. Regions are created from areas of homogenous pathfinding nodes (i.e. all the same collision mask etc.) within a single chunk. There's probably a better data structure to use for regions but even this version gives a significant speedup for the AI checking whether it can access an entity or not. My first version just tried using a BFS pathfinder for vision range but it was significantly slower, plus this version is more easily cached and AI can share their cache as well. Adds 2 commands for debugging: pathfinder regions shows every region in different colours pathfinder regioncache will show when the AI is checking for accessibility (green means cache is updated, blue means existing cache hit).
And some other nitpicks
rbertoche
pushed a commit
to rbertoche/space-station-14
that referenced
this pull request
Mar 16, 2023
Round 4 of Doafter fixes (space-wizards#14476)
TheArturZh
referenced
this pull request
in TheArturZh/space-station-14
Aug 17, 2023
TheArturZh
referenced
this pull request
in SerbiaStrong-220/space-station-14
Aug 17, 2023
Morb0
added a commit
to Morb0/space-station-14
that referenced
this pull request
Sep 24, 2023
rbertoche
pushed a commit
to rbertoche/space-station-14
that referenced
this pull request
May 18, 2024
rbertoche
pushed a commit
to rbertoche/space-station-14
that referenced
this pull request
May 18, 2024
Erisfiregamer1
pushed a commit
to The-Arcadis-Team/arc-station-14
that referenced
this pull request
Dec 17, 2024
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Ports jackboot slowdown mitigation from [space-wizards github](space-wizards#30586). Adds fake version for civilian use. --- # Changelog <!-- You can add an author after the `:cl:` to change the name that appears in the changelog (ex: `:cl: Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> :cl: - add: Added slowdown mitigation to jackboots - add: Added fake jackboots for style outside of sec --------- Co-authored-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com>
Erisfiregamer1
pushed a commit
to The-Arcadis-Team/arc-station-14
that referenced
this pull request
Dec 17, 2024
rhit-eppersac
pushed a commit
to Kandiyaki/space-station-14
that referenced
this pull request
Jan 14, 2025
forgot intellicard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Like the first third of a hierarchical pathfinder. This system prevents AI from trying to pathfind into areas they can't get to.
Previously it was Grid -> Chunks -> Nodes
Now there's also Grid -> Chunks -> Regions -> Nodes (where regions slot themselves into the existing system).
The reason for this is it's faster to traverse regions rather than nodes because regions are made up of tiles. My first attempt I tried just using the BFS pathfinder on nearby tiles so the AI could tell whether it could access a particular node but even with caching it was too slow.
Regions are created from areas of homogenous pathfinding nodes (i.e. all the same collision mask, all space etc.) within a single chunk, though currently walls are ignored for now.
There's probably a better data structure to use for regions but even this version gives a significant speedup for the AI checking whether it can access an entity or not. Plus some of the chunk update stuff is grossly inefficient.
AI can also re-use existing cached reachable regions as well.
Adds 2 commands for debugging:
pathfinder regions
shows every region in different colourspathfinder regioncache
will show when the AI is checking for accessibility (green means cache is updated, blue means existing cache hit).I also re-wrote the wander behavior so the idle AI should be SIGNIFICANTLY faster and not spamming out paths to places it can't get to twice a second.
For reference I know Factorio and Rimworld have their own hierarchical systems and this one falls more on the Rimworld side (though rooms aren't generated and the chunk update is inefficient).