Conversation
…pathfinding method
…lities to Pathfinder
New Feature: GetPathsParallel function added to process a batch of path requests outside the agent system in parallel.
Refactor: Pathfinder constructor expanded with initial capacities for internal collections and parallelProcessing/ pathRequests parameters.
…view or a copy of the rects list. Feat: Added a new Copy() method for copying an existing path (deep copy).
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces object pooling and parallel processing capabilities to the pathfinding system to improve performance and reduce allocations.
Key changes include:
- Implemented object pooling for
Pathinstances to minimize garbage collection overhead - Converted
AStarfrom a static class to an instance-based class to support thread-local usage - Added parallel processing support for handling multiple path requests concurrently
- Made collection capacities configurable via constructor parameters to optimize memory allocation
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
| ShapeEngine/Pathfinding/Pathfinder.cs | Added parallel processing toggle, configurable capacity parameters, thread-local AStar instances, and methods for parallel path computation |
| ShapeEngine/Pathfinding/Path.cs | Implemented object pooling with rent/return methods, changed from immutable to mutable design, added helper methods for pool management |
| ShapeEngine/Pathfinding/IPathfinderAgent.cs | Added documentation about path pooling requirements |
| ShapeEngine/Pathfinding/AStar.cs | Converted from static to instance-based class, added async pathfinding support, integrated with Path pooling system |
| Examples/Scenes/ExampleScenes/PathfinderExample2.cs | Updated to use new parallel processing feature and properly return paths to the pool |
| Examples/Scenes/ExampleScenes/PathfinderExample.cs | Added path cleanup logic to properly return paths to the pool |
Comments suppressed due to low confidence (1)
ShapeEngine/Pathfinding/IPathfinderAgent.cs:1
- Corrected spelling of 'classed' to 'class' in documentation.
namespace ShapeEngine.Pathfinding;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Feat: PathfinderExample2 player can now spawn obstacles. Refactor: General cleanup, typos fixed, some docs improved. Fix: Node ApplyNodeValue did only apply node value when no layer was used or when layer did not exist. Values were never applied for existing layers.
… cost management Refactor: NodeWeight Cur value calculation changed.
This file contains hidden or 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
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.
This pull request adds parallel processing option to the
Pathfinderclass. Additionally, paths can now be requested asynchronous and multiple paths can be requested at once to be processed in parallel.The
Pathclass was overhauled to be pooled (minimizing small heap allocations) and the access to the internal rects list is now a readonly view for better clarity. Once aPathis recieved by an agent or returned from the standaloneGetPath()functions it can be used or copied but it should not be modified. It has to be returned to the pool once it is no longer needed. After returning aPathinstance it should no longer be accessed.The internal
AStarclass was changed from a static class to an instance class. This allows each thread (when parallel processing is enabled) to have its ownAStarinstance.