Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbpagano/cellular-automata
3D Celullar Automata using the Bevy engine
https://github.com/gbpagano/cellular-automata
3d bevy cellular-automata rust
Last synced: 4 months ago
JSON representation
3D Celullar Automata using the Bevy engine
- Host: GitHub
- URL: https://github.com/gbpagano/cellular-automata
- Owner: gbPagano
- License: mit
- Created: 2024-08-23T02:41:06.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-06T23:22:40.000Z (5 months ago)
- Last Synced: 2024-10-09T20:03:28.170Z (4 months ago)
- Topics: 3d, bevy, cellular-automata, rust
- Language: Rust
- Homepage: https://gbpagano.github.io/cellular-automata/
- Size: 7.68 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 3D Cellular Automaton
This project implements a 3D Cellular Automaton (CA) using the Bevy engine. Cellular
automata are systems where cells evolve over discrete time steps based on the states of
neighboring cells. By extending CA into three dimensions, this project offers dynamic
and visually engaging simulations.https://github.com/user-attachments/assets/b93fdb0c-372c-4d9a-a716-b73793113dfe
This project was inspired by and based on the article "3D Cellular Automata" by Jason Rampe.
You can read the original article [here](https://softologyblog.wordpress.com/2019/12/28/3d-cellular-automata-3/).## Neighborhoods
In cellular automata, neighborhoods define which cells around a given cell influence
its behavior—such as its birth, survival, or death. In a 3D CA, two common types of
neighborhoods are used:### Moore Neighborhood
The Moore neighborhood in 3D consists of the 26 cells surrounding the current cell,
similar to the cells in a Rubik’s cube with the center being the current cell.
Imagine a 3x3x3 grid of small cubes; the center cube is the current cell, while the
other 26 cubes are its neighbors.### Von Neumann Neighborhood
The Von Neumann neighborhood in 3D includes only the 6 cells that share a face with the
current cell. These are the cells located along the positive and negative X, Y, and
Z axes, forming a 3D cross or "plus sign."## Rule System
Rules dictate how cells transition between states based on their neighborhood
configuration. This project supports customizable rule configurations applied to the
simulation. Here are two examples:### Rule 445 (4/4/5/M)
- **Survival**: A cell in state 1 survives if it has 4 neighboring cells.
- **Birth**: A new cell is born in an empty location if it has 4 neighbors.
- **States**: The automaton has 5 states. Newly born cells start in state 4, fade to state 1,
and eventually die in state 0.
- **Neighbours**: Uses the Moore neighborhood.### Builder Rule (2,6,9/4,6,8-10/10/M)
- **Survival**: Alive cells with 2, 6, or 9 neighbors survive.
- **Birth**: New cells are born in empty locations if they have 4, 6, 8, 9, or 10 neighbors.
- **States**: Supports 10 states, with 8 intermediate states.
- **Neighbours**: Uses the Moore neighborhood.## Multi-State Automata
In multi-state cellular automata, cells transition through several states before dying.
For example, in a 5-state automaton, a new cell starts in state 4 and progresses through
states 3, 2, and 1 before reaching state 0 (dead). This fading effect adds complexity and
visual interest to the simulation.## Color Methods
To enhance the visual representation of the 3D Cellular Automaton, three color methods
have been implemented:### Distance to Center
Cells are colored based on their distance from the center of the 3D space, creating a
gradient effect that distinguishes cells by their location.### State Lerp
This method uses Linear Interpolation to color cells based on their current state,
providing smooth transitions between states and visualizing state changes.### Neighbors Lerp
Cells are colored based on the number of neighboring cells in a specific state.
This method produces a gradient effect that reflects the density or influence of
neighboring cells.## Running the Project
To run the project locally, follow these steps:
1. Clone the repository:
```sh
git clone https://github.com/gbPagano/cellular-automata.git
cd cellular-automata
```
2. Build and run the project:
```sh
cargo run --release
```---
Feel free to submit a PR if you have suggestions, bug fixes, or new features.