Struct hierarchical_pathfinding::PathCacheConfig [−][src]
pub struct PathCacheConfig { pub chunk_size: usize, pub cache_paths: bool, pub a_star_fallback: bool, pub perfect_paths: bool, }
Expand description
Options for configuring the PathCache
Default options:
assert_eq!( PathCacheConfig { chunk_size: 8, cache_paths: true, a_star_fallback: true, perfect_paths: false, }, Default::default() );
Fields
chunk_size: usize
Expand description
The size of the individual Chunks (defaults to 8
)
tl;dr: Depends highly on the size of your Grid and Lengths of your Paths; requires Experimentation if you care.
Rough guide: Scale with a bigger Grid and longer desired Paths. (don’t quote me on this)
This has many different effects on the Performance and Memory:
smaller chunks make calculations within a Chunk faster
- => decreased update time in tiles_changed
- => decreased time to find start and end Nodes
bigger chunks lead to fewer Chunks and Nodes
- => decreased time of actual search (especially for unreachable goals)
- => longer Paths can be found a lot faster
Use Case | Recommendation |
---|---|
Frequent Updates | Smaller Chunks |
Longer Paths required | Larger Chunks |
Larger Grid | Larger Chunks |
“No Path found” is common | Larger Chunks |
Grid consists of small, windy corridors | Smaller Chunks |
cache_paths: bool
Expand description
true
(default): store the Paths inside each Chunk.
false
: only store the Cost of the Path.
If set to false, calculating the full Path between two Points takes significantly more time.
See AbstractPath
for more details.
a_star_fallback: bool
Expand description
true
(default): When a Path is short (roughly Length < 2 * chunk_size
), a regular
A* search is performed on the Grid after HPA* calculated a Path to confirm the
existence and length.
false
: The Paths are left as they are.
Setting this option to false will improve performance a bit, but the Paths will take seemingly random detours that makes them longer than they should be.
perfect_paths: bool
Expand description
true
: Nodes are placed on every open entrance of a Chunk. This means that the resulting
Paths are always the most optimal ones, but both Memory Usage and Performance are worse.
false
(default): Nodes are placed on only some chunk entrances.
The exact effect depends greatly on the Grid and how the Chunks and their entrances align.
Implementations
impl PathCacheConfig
[src]
impl PathCacheConfig
[src]pub const LOW_MEM: PathCacheConfig
[src]
pub const LOW_MEM: PathCacheConfig
[src]an example PathCacheConfig with options set to reduce Memory Usage
Values:
assert_eq!( PathCacheConfig { chunk_size: 32, cache_paths: false, a_star_fallback: true, perfect_paths: false, }, PathCacheConfig::LOW_MEM );
pub const HIGH_PERFORMANCE: PathCacheConfig
[src]
pub const HIGH_PERFORMANCE: PathCacheConfig
[src]an example PathCacheConfig with options set to improve Performance
Values:
assert_eq!( PathCacheConfig { chunk_size: 8, cache_paths: true, a_star_fallback: false, perfect_paths: false, }, PathCacheConfig::HIGH_PERFORMANCE );
Trait Implementations
impl Clone for PathCacheConfig
[src]
impl Clone for PathCacheConfig
[src]fn clone(&self) -> PathCacheConfig
[src]
fn clone(&self) -> PathCacheConfig
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for PathCacheConfig
[src]
impl Debug for PathCacheConfig
[src]impl Default for PathCacheConfig
[src]
impl Default for PathCacheConfig
[src]fn default() -> PathCacheConfig
[src]
fn default() -> PathCacheConfig
[src]Returns the “default value” for a type. Read more
impl PartialEq<PathCacheConfig> for PathCacheConfig
[src]
impl PartialEq<PathCacheConfig> for PathCacheConfig
[src]fn eq(&self, other: &PathCacheConfig) -> bool
[src]
fn eq(&self, other: &PathCacheConfig) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &PathCacheConfig) -> bool
[src]
fn ne(&self, other: &PathCacheConfig) -> bool
[src]This method tests for !=
.
impl Copy for PathCacheConfig
[src]
impl StructuralPartialEq for PathCacheConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for PathCacheConfig
impl Send for PathCacheConfig
impl Sync for PathCacheConfig
impl Unpin for PathCacheConfig
impl UnwindSafe for PathCacheConfig
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more