emergent/
lib.rs

1//! __Modern, modular and hierarchical way to define complex behaviors using simple building blocks.__
2//!
3//! Main concepts
4//! ---
5//! - __Task__ - Units of work performed in time ([`crate::task`])
6//! - __Decision Makers__ - State change engines ([`crate::decision_makers`])
7//! - __Condition__- Answers to questions about certain memory states ([`crate::condition`]. [`crate::combinators`])
8//! - __Considerations__ - Scored probabilities of certain memory states ([`crate::consideration`], [`crate::evaluators`])
9//! - __Memory__ - Memory is the state passed to all concepts listed above to be read/write by them.
10//!   In other AI systems memory is also known as blackboard or context.
11//!
12//! Note that AI techniques provided by this library are usable not only for agent behaviors but
13//! also for building emergent storytelling when used for smart world events generation. In fact AI
14//! can be used for automation and modularization of many aspects of game logic, not only agents
15//! and events - consider your creativity being the only limit of what AI techniques can be used for.
16
17pub mod builders;
18pub mod combinators;
19pub mod condition;
20pub mod consideration;
21pub mod decision_makers;
22pub mod evaluators;
23pub mod memory;
24pub mod score_mapping;
25pub mod task;
26
27#[cfg(test)]
28mod tests;
29
30use crate::{decision_makers::DecisionMaker, task::Task};
31
32#[cfg(not(feature = "scalar64"))]
33pub type Scalar = f32;
34#[cfg(feature = "scalar64")]
35pub type Scalar = f64;
36
37pub type DefaultKey = String;
38
39pub trait DecisionMakingTask<M = (), K = DefaultKey>: DecisionMaker<M, K> + Task<M> {}
40
41impl<T, M, K> DecisionMakingTask<M, K> for T where T: DecisionMaker<M, K> + Task<M> {}
42
43#[doc(hidden)]
44pub mod prelude {
45    pub use crate::{
46        builders::{behavior_tree::*, lod::*, *},
47        combinators::{all::*, any::*, count::*, *},
48        condition::*,
49        consideration::*,
50        decision_makers::{
51            machinery::*, parallelizer::*, planner::*, reasoner::*, selector::*, sequencer::*, *,
52        },
53        evaluators::{max::*, min::*, product::*, sum::*, *},
54        memory::{blackboard::*, datatable::*, *},
55        score_mapping::*,
56        task::*,
57        DecisionMakingTask, DefaultKey, Scalar,
58    };
59}