Skip to content
/ petnat Public

A Petri net plugin for Bevy Engine.

Notifications You must be signed in to change notification settings

nxsaken/petnat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Crates.io Crates.io docs.rs

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

  1. Build a model using places and transitions.
  2. Define a PetriNet<NetId> resource.
  3. Add a Token<NetId> component to an entity.
  4. Mark some (probably initial) places with the Token according to the model.
  5. Fire transitions when it makes sense according to the model.
  6. Implement game logic based on the current marking of the Token.

Examples

Examples can be found in the examples directory.