Crates.io | pure-hfsm |
lib.rs | pure-hfsm |
version | 0.1.0 |
source | src |
created_at | 2021-12-15 10:43:55.630655 |
updated_at | 2021-12-15 10:43:55.630655 |
description | A finite state machine library with a clear separation between the machine definition and its changing state |
homepage | |
repository | https://github.com/nicopap/pure-hfsm |
max_upload_size | |
id | 498263 |
size | 38,682 |
A finite state machine library with a clear separation between the machine definition and its changing state.
I developed this library for my bevy project. This is why I give generic
lifetime parameters to Behavior::World
, Behavior::Update
and
Transition::World
types. This requires GATs, but I found it was the only way
to get it to work with the horror that is SystemParam
in bevy.
The goal of the library is to have the state machine description be completely independent from the state. From this, we get a lot of cool stuff that other state machine libraries do not let you do easily or trivially, such as:
Component
(while the
state machines are loaded as Asset
)There is a few downsides to know before using this library:
builder::StateMachines
! Which is far better than an error when running
transitions, but still not as optimal as a compilation error.StateMachines
type you have to interact with in
order to use this library (1) is the serialized representation builder
(2)
is the compact immutable description (3) is the mutable state handle or
label
.For the serialized representation of the state machine to still be convenient
and maintainable while having a compact internal representation, you will need
to use builder::StateMachines
for serde interface and convert it into a
runnable state machine as a second step.
serde
cargo feature flag to be able to compile the library without serdeStateData
Box<dyn Any>
Copyright © 2021 Nicola Papale
This software is licensed under either MIT or Apache 2.0 at your leisure. See LICENSE file for details.
If you use this library in a commercial product that earns more than 1 million of revenue in equivalent January 2021 US dollar, you will do one of the following:
Not doing one of the first three items, it will always be assumed that the terms are complied-with according to the last item. Moral responsibility does not imply any other obligation than feeling shame. Most notably, no financial or legal obligations are implied by this.