Expand description
A Petri net plugin for Bevy Engine. 🍾
§About
petnat
equips you with Petri nets to use in your Bevy projects.
It’s a powerful way to model states, processes, resources, and more.
This is a very experimental project, and I mostly started it because I wanted to play with Petri nets and improve my Rust. I am not sure about the possible usefulness of this plugin, but I hope to discover how I can improve it with time and usage.
§Rough idea
- Build a model using places and transitions.
- Define a
PetriNet<NetId>
resource. - Add a
Token<NetId>
component to an entity. - Mark some (probably initial) places with the
Token
according to the model. - Fire transitions when it makes sense according to the model.
- Implement game logic based on the current marking of the
Token
.
§Examples
Check out this example demonstrating a simple Petri net in action, as well as the tests here for more Petri net instances.
Structs§
- Petri
Net - Petri net.
- Petri
NetBuilder PetriNet
builder.- Petri
NetPlugin - Plugin that initializes and manages a
PetriNet
. - PlaceId
- Reference to a place in a net.
- Token
- Petri net token. Holds the state of the net execution.
- TransId
- Reference to a transition in a net.
Enums§
- Nn
- Numbered
NetId
for convenience. - Pn
- Numbered
Place
compatible with any [PetriNet
] for convenience. - Tn
- Numbered
Trans
compatible with any [PetriNet
] for convenience. - W
- Arc weight.