This project is modeled after a similar project I did this summer in C++ and Raylib. For more information about that project, see its GitHub page: [ Ссылка ]
I choose to rewrite it in Rust using WGPU for 2 main reasons:
1) It could run on the web
2) I could use compute shaders to greatly increase performance (currently runs more than 10 times faster natively and 4 times faster on the web than the old version)
You can play with this simulation without downloading anything by visiting: [ Ссылка ]
This GitHub page from this project can be found here: [ Ссылка ]
The project has many branches, but only some work/are currently being updated (I recommend you get the latest working downloads from the itch.io link above).
Cell rules: 2,6,9/4,6,8,9/10/M
Survival: 2, 6, 9
Spawn: 4, 6, 8, 9
State: 10
Neighborhood: Moore
Cell rule explained:
There are 4 rules: survival, spawn, state, and neighborhoods. A cell can be in one of 3 states: alive, dying, or dead.
Survival:
A list or single number (example: [X, Y, ...])
If a cell is alive, it will remain alive if it has X, Y, or ... neighbors (only applies to alive cells)
If it does not have X, Y, or ... neighbors, it will begin dying
Spawn:
A list or single number (example: [X, Y, ...])
Can have any amount of overlap with survival (only applies to dead cells)
If a cell is dead, it will come alive if it has X, Y, or ... neighbors
State:
Must be a single number (example: X)
Once a cell begins dying, it has X simulation/update ticks to live before disappearing (only applies to dying cells)
Both survival and spawn rules will no longer affect the cell while it decays
Neighborhoods:
"Moore" or "Von Neumann"
How neighbors are counted (applies to all cells)
"Moore":
- Neighbors are any cells where 1 away, including diagonals
- Think like a Rubik's cube where the current cell is the middle, all the outside/colored cubes are the neighbors
- 3^3 - 1 = 26 possible neighbors
"Von Neumann":
- Neighbors are only cells where the faces touch
- 6 possible neighbors
About the coloring
Alive cells: red
Dying cells: grey scale from white to black based on how close the cell is to dead
Dead cells: not drawn (obviously)
More information:
- [ Ссылка ]
- [ Ссылка ]
This video is not sped up at all, it is running in real time at 40~50 ticks per second.
Computer (Galaxy Book Flex) specs:
- CPU: Intel® Core™ i5-1135G7 Processor @ 2.40 GHz
- GPU: Intel® Iris® Xe Graphics (integrated)
- RAM: 8 GB (LPDDR4x)
Thanks for watching!
Ещё видео!