1 unstable release
Uses new Rust 2024
| 0.1.0 | Jul 13, 2025 |
|---|
#3 in #skill-tree
106 downloads per month
Used in 14 crates
(9 directly)
260KB
5K
SLoC
capability-grower-configuration
The capability-grower-configuration crate provides a versatile system for configuring the growth and expansion policies of skill trees. This is particularly useful for applications involving hierarchical layouts of skills, abilities, or knowledge concepts. The crate essentially allows the user to describe how a skill tree ought to be expanded and sorted, featuring granular configurability options and error handling mechanisms.
Features
- Capstone Nodes: Control the generation of capstone nodes using
CapstoneMode, which can be Off, Single, or Probabilistic. - Complexity Management: Set the desired tree complexity via
ConfigurationComplexityto handle simple to complex configurations. - Tree Expansion Policies: Choose from multiple tree expansion strategies including
Simple,Weighted,DepthBased,AlwaysAggregate, and custom scripting support. - Level-Specific Configuration: Specify overrides for tree level breadth and density.
- Ordering Policies: Control the sorting of sub-branches with various
SubBranchOrderingoptions.
Structs & Enums
CapstoneMode: Determines how capstone nodes are handled, ranging from none to probabilistic modes.ConfigurationComplexity: Manages complexity versus usability, offering Simple, Balanced, and Complex variants.TreeExpansionPolicy: Indicates strategy for node type selection in tree growth.WeightedNodeVariantPolicy: Uses weights for random node variant selection.
Configuration & Errors
The crate provides structures for error handling, such as GrowerTreeConfigurationError for validating configurations. Errors include validation constraints like depth, breadth, or density violations.
Usage
The configuration allows for complex tree-structural settings, aiding in dynamic layout generation for various application domains. Utilize the builder pattern to craft configurations and leverage the rich suite of validation functions to ensure correctness.
Example
use capability_grower_configuration::{GrowerTreeConfiguration, CapstoneMode};
let config = GrowerTreeConfiguration::base_config(3, 5, 2)
.with_level_specific(vec![3, 4, 5], vec![2, 2, 2])
.with_capstone(CapstoneMode::Single, 0.1);
// Validate and utilize configuration
match config.validate() {
Ok(_) => println!("Configuration is valid."),
Err(e) => println!("Configuration error: {:?}", e),
}
Note: This README.md was generated by an AI model and may not be 100% accurate, however, it should be pretty good.
Dependencies
~48–91MB
~1.5M SLoC