This project was one I tackled in my free time. I wanted to try something different that was outside of the realm of game development, so I chose to experiment with koch snowflake algorithm. I used Unity to build the project in and wrote C# scripts to get the work done.
I created an empty game object and attached a line renderer to it. In the script, I added options to change the shape of the “initiator.” The user would be able to start from a triangle, square, hexagon, heptagon or an octagon. The “initiator” would be the shape the line renderer would take on at run-time. The user also has the option to modify the initator size as well.
The “generate multiplier” and “lerp amount” variables in the inspector offer the user control over how to modify each generation of lines. I then chose to initiate new generations with the “O” and “I” keys. The “O” key would have the next generation would stretch outward. The “I” key would have the next generation stretch inward. I later added a bezier curve option and a “bezier vertex count” variable in order to have control over how much I could smooth out a line. However, I found that on occasion, some of the lines would not line up with other generations. This could be seen in one of the snowflake screencaps above.
Some minor details I added to the project was the ability to choose what axis the line renderer would generate along. I also added a basic rotation script to the game object to have some kind of motion while the generations were being initialized.
In the end, I did learn a lot from this project as I hoped I would. I did learn that my approach was not exactly resource friendly. At the time, my computer had 8GB of memory and I found that the project would quickly eat up my memory as I created more generations. It took me some time to figure out the issue, although I didn’t really know how to resolve it efficiently enough. I hope to someday revisit this project and find a better way to rebuild it and use it for something practical in a future project.