[−][src]Struct hierarchical_pathfinding::PathCacheConfig
Options for configuring the PathCache
Default options:
assert_eq!( PathCacheConfig { chunk_size: 8, cache_paths: true, keep_insertions: true, use_nearby_nodes_for_search: true, a_star_fallback: true, perfect_paths: false, }, Default::default() );
Fields
chunk_size: usize
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: integer divisor of the Grid size and somewhere between 8 and 32. (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 Node insertion time for start and end Nodes during find_path
- => may decrease initial calculation (less work within a chunk)
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
- => may decrease initial calculation (fewer chunks)
cache_paths: bool
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.
keep_insertions: bool
true
(default): any Points inserted when calling find_path or find_paths are left in the Graph.
false
: the Points are deleted at the end of those functions.
Keeping Points slightly increases future search times and memory usage, but makes searches to or from those same Points a lot faster.
use_nearby_nodes_for_search: bool
true
(default): Allows the use of a neighboring Node for start and end Nodes when searching Paths
instead of always inserting a new Node.
false
: creates a new one if there is no Node on the exact Tile.
This drastically improves Performance and Memory usage of searches, but may result in the first or last step of a Path being a detour to get to that Neighbor.
This is overwritten by perfect_paths
a_star_fallback: bool
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
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.
setting this is true
, overwrites use_nearby_nodes_for_search
to be false
Implementations
impl PathCacheConfig
[src]
pub const LOW_MEM: PathCacheConfig
[src]
an example PathCacheConfig with options set to reduce Memory Usage
Values:
assert_eq!( PathCacheConfig { chunk_size: 16, cache_paths: false, keep_insertions: false, use_nearby_nodes_for_search: true, a_star_fallback: true, perfect_paths: false, }, PathCacheConfig::LOW_MEM );
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, keep_insertions: true, use_nearby_nodes_for_search: true, a_star_fallback: false, perfect_paths: false, }, PathCacheConfig::HIGH_PERFORMANCE );
Trait Implementations
impl Clone for PathCacheConfig
[src]
fn clone(&self) -> PathCacheConfig
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for PathCacheConfig
[src]
impl Debug for PathCacheConfig
[src]
impl Default for PathCacheConfig
[src]
fn default() -> PathCacheConfig
[src]
impl PartialEq<PathCacheConfig> for PathCacheConfig
[src]
fn eq(&self, other: &PathCacheConfig) -> bool
[src]
fn ne(&self, other: &PathCacheConfig) -> bool
[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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,