NodeTree
NodeTree is a framework to create large scalable programs and games through a tree of processes. Each process is fully autonomous and is capable of storing its own state or data, and communicating with other processes. These processes are known as Nodes.
⚠️WARNING⚠️ THIS IS A NIGHTLY-DEPENDENT CRATE. This crate is in early development. Beware of possible bugs or safety violations. The specific nightly version this crate uses is v1.78.
Getting Started!
Simply either run cargo add node_tree at the terminal directed towards the directory of your project, or add node_tree = X.X to your cargo.toml file.
To begin creating a program in Rust that utilizes a NodeTree, we must first create a root Node. In order to reduce boilerplate, we will use the included NodeSys derive macro to implement the required Dynamic and NodeAbstract traits. We will then implement the Node trait ourselves.
// Required for now.
use *;
// To make things simple, it is advised to have most node constructors return the node
// instance wrapped inside of this crate's `Hp<T>` pointer.
// Example implementation of the Node trait with custom behaviours.
Finally, in order to activate our NodeTree, we must instance the root Node and feed it into the NodeTree constructor.
// ...previous implementations
Features
- 🏗️ An easy abstraction framework for different processes to communicate and interact with each other in a scalable manner. Inspired by Godot!
- ⏯️ The ability to
pause()andunpause()theNodeTree, and fine tune individualNodebehaviours for when a tree is paused/unpaused. - 📡 Various methods to communicate with other nodes, such as
owner(),parent(),get_child(),children(), andget_node(). - 🔗 An abstracted smart pointer known as
Hp<T>which clones implicitly to reduce syntax noise and allows for low boilerplate. - 👪 The ability to manage nodes with
add_child()andremove_child(). - 🌲 Allows for the direct referencing of the
NodeTreethrough a node'sroot()function. - 📚 TODO: A caching system hosted on the
NodeTreeto act as a safe interface to ensure theHp<T>soundness, and increase performance! - 📜 TODO: Includes a method to save and handle individual node scenes, such as the handy visual macro
Scene!.