Wave Function Collapse
That's right! I'm starting a new project, based entirely upon personal interest that will most certainly negatively impact my GPA. This new function is creating a procedurally generated Unity Tile Map using Wave Function Collapse methodology. I aim to use this marvelous piece of software in other systems later in my career, so understanding the fundamentals now is vital.
My obsession began after becoming hooked on the 4X (eXplore, exPand, eXploit, eXterminate) mobile game, The Battle of Polytopia. This cute little war simulator is essentially a more digestible Civilization game. Most relevant, is the game's core feature of replay-ability by using a new procedurally generated map each game (see below). Each player's tribe has a unique set of influences that alter the frequency of each tile type. This creates a connection to their land, and makes venturing past the familiar natural land formations a daunting experience as unknown threats lie within the fog of war.
Polytopia map generation has 2 core tile types at play - land and sea. The above picture demonstrates the relationship they share: where land and sea are orthogonally adjacent, a coastal sea (light blue) tile is used. Within this outer hierarchy are many more layers of rules that will alter resource spawns in an attempt at a fair player experience.
These colorful maps are all the result of the Wave Function Collapse formula, which is what I hope to imitate.
My current progress is what inspired this blog post. A clear and detailed Unity tutorial by Sunny Valley Studio is teaching me the first few steps of this algorithm. Using episode 12 of the tutorial, I have created an algorithm to recognise distinct tiles in a map. From this stage, relationship patterns of each tile will be analyzed to help create an entirely new tile map.
The algorithm has indexed and returned the tiles as the center of the grid, starting from the bottom left: [5, 6, 6] [3, 0, 5] [0, 1, 2] As shown, the pair of 'path ends' and 'forest' tiles have the same index. The outer edge of numbers are predictions based on the inner tiles. This will be useful in later episodes, I'm told.
Regardless, thanks for reading my first installment in this new project.











