All we need is a method to retrieve our neighbors of any given coordinate.In TilemapStructure let’s add a method With this method, we can now retrieve all 8 neighbors of a given tile coordinate.We’ll also add some configuration, like what is the target tile type we should apply the automata on, what tile should we replace it by if the criteria is not met.A brief idea of how the dominant tile would work is simple.Let’s take a look at the plain replace by tile logic Here we loop over all the tiles and we retrieve the neighbors of the current tile only if the current tile matches our configured TargetTile.Let’s add the dominant tile logic as an extra option.Here we use System.Linq to chain several actions together.Here is how the final class should look like:Let’s now Create the ScriptableObject algorithm in unity and assign it to our ObjectMap algorithm’s right after the TreeGeneration algorithm.Note that 65% tree generation without automata is very obscure and unrealistic.The github repository commit for this Tutorial can be found here:The source files can be found here:Fill in your details below or click an icon to log in: Each cell is capable of holding a value to indicate how much liquid is contained inside of it. This means that they can run any program or algorithm of your choice, if properly encoded in its grid. Reddit. But I am not sure how to make it expand infinitely and detect collision.Thanks for contributing an answer to Stack Overflow! By using our site, you acknowledge that you have read and understand our Finding a balance that works for you will be an important step to take when implementing a system like this.Left Click to place/remove walls.

2D Cellular automaton based ink simulation for Unity. Posted by ven0maus 22 July 2020 23 July 2020 Posted in World Generation Tags: … Doing so, would render the liquids like this:Although this type of liquid simulation is a great for grid based solutions, in order for the liquid to be fluid, it requires a high iteration rate on each frame. If it does contain more liquid, then the cell becomes pressurized. The second is that if statements are notoriously slow when used within a shader. This behavior is illustrated below: Especially the parts that are only available on Patreon.If the knowledge you have gained had a significant impact on your project, a mention in the credit would be very appreciated. If you think these posts have either helped or inspired you, please consider supporting this blog.You will be notified when a new tutorial is relesed!You are free to use, adapt and build upon this tutorial for your own projects (even commercially) as long as you credit me.You are not allowed to redistribute the content of this tutorial on other platforms.