Attempting to implement Conway's Game of Life in Godot with F#.
Starting by using this repository from this tutorial on GDScript.com for inspiration.
Given that this changes from using GDScript to F# as well as from Godot 3 to 4 these will end up being fairly different.
WIP - after wanting to try things with a larger kernel and continuous values instead of discrete, I learned that this is already a thing with its own sub-community within the greater cellular automata community. After learning more I'm ready to try my hand at figuring out good ways to apply it in a shader in Godot.
Kernel to start looks like this:
[
[0, 0, w, w, w, 0, 0],
[0, w, w, w, w, w, 0],
[w, w, w, w, w, w, w],
[w, w, w, 0, w, w, w],
[w, w, w, w, w, w, w],
[0, w, w, w, w, w, 0],
[0, 0, w, w, w, 0, 0]
]
Where w is a uniform weight.
Use own cell after first pass of calculation only.
Planned steps as of now: 0) convert nearby neighbors from RGB to HSL
- multiplying nearby neighboring cells lightness values by their weights from the kernel
- calculate the sum of the weights of the kernel
- divide the sum of the weighted neighboring cells by the sum of the weights of the kernel
- apply smoothstep to the result of the division REMINDER: Need to be able to easily change the smoothstep inputs
- that gives a new lightness value to use
- get current hue (changes over time)
- get saturation (const to start)
- HSL to RGB conversion
- set new RGB value to cell
Using a 1-dimensional array for the kernel to start. This is the 49 element array we'll use at first:
[
0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0
]
Wonder what it would take to get some drag-to-select functionality going.
Could then try adding:
- Move selection
- Copy/paste selection
Would need to make it so that when dragging the shape would try to stick/snap to the grid while moving around.
Being able to save/load layouts would be nice for playing around with things.
Once the ability to save/load exists it shouldn't be too bad to make a few example setups of varying complexities. Could then automate testing of how long it takes to execute X frames and use that for benchmarking.