documented genome tools
This commit is contained in:
parent
edb5ed4b1e
commit
fc4d9d2ee3
4 changed files with 106 additions and 11 deletions
62
docs/en/genome.md
Normal file
62
docs/en/genome.md
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# Genome
|
||||
|
||||
This document describes principles I have came up with. I don't think I'd be angry if you use them in your projects.
|
||||
This document is mostly for me to remember things.
|
||||
|
||||
## Used terms and placeholders
|
||||
(Very WIP) - This section is subject to change.
|
||||
<Context> - Placeholder for context arguments. Currently I didn't think of this but I acknowledge that I might need them.
|
||||
<T> - Type that doesn't exist yet but is obvious in context of section.
|
||||
|
||||
## The core principles are:
|
||||
- Every plant can be represented as graph (sometimes as a tree).
|
||||
- Every value of a node can be also a node (I might iterate on this one).
|
||||
- Every node can have input and output.
|
||||
- If node has input, and parent has output, parent must spread its output.
|
||||
|
||||
## Genome
|
||||
### Gene
|
||||
Genes are main logic elements of a plant. They're nodes of genetics graph.
|
||||
I might iterate over this, but in current implementation is a little bit functional due to complications of OOP in Rust.
|
||||
Gene structure consists of variables specific to gene, type and overridable methods for displaying itself and its children.
|
||||
|
||||
(Very WIP) Variables:
|
||||
- Dictionary with some string type as a key and Argument enum.
|
||||
- Argument enum consists of f32 and i64.
|
||||
|
||||
Type of gene is enum that provides different functions. Here is (Very WIP) list of every type and its provided functions:
|
||||
|
||||
Dummy - gene without behaviour.
|
||||
|
||||
Transport - gene that defines rules of flow.
|
||||
- `distribute_between_children(<context>) -> ChildDistribution`
|
||||
|
||||
Pure Producer - gene that only creates flow.
|
||||
- `create_flow(<context>,current_flow: mut Flow) -> Flow` - won't be called if flow isn't empty.
|
||||
|
||||
Producer - gene that creates or modifies flow.
|
||||
- `create_flow(<context>) -> Flow` - called if ProduceDecision::CreateFlow
|
||||
- `modify_single(<context>) -> Flow` - called if ProduceDecision::ModifySingle
|
||||
- `modify_all(<context>) -> Flow` - called if ProduceDecision::ModifyAll
|
||||
|
||||
Modifier - gene that only modifies flow.
|
||||
- `modify_flow(<context>) -> Flow`
|
||||
|
||||
Consumer - gene that consumes flow.
|
||||
- `consume(<context>)`
|
||||
|
||||
Trigger - gene that interacts with context to conditionally progress flow.
|
||||
- `check_trigger(<context>) -> bool`
|
||||
- `distribute_between_children(<context>) -> ChildDistribution` - same as Transport
|
||||
|
||||
Observer - gene that observes flow.
|
||||
- `observe(<context>)`
|
||||
- `distribute_between_children(<context>) -> ChildDistribution` - same as Transport
|
||||
|
||||
### Flow
|
||||
Flow is data that circulates across genome. If not consumed, goes to the void.
|
||||
|
||||
Currently it is struct containing Vec<ProjectileData>
|
||||
|
||||
### Context
|
||||
<context> consists of current Flow struct and Godot context. Godot context should at least be Plant node.
|
||||
Loading…
Add table
Add a link
Reference in a new issue