2017 - 2018
Infasy is the title of a game project I worked on alone from 2017 to 2018. The goal was to learn about various procedural generation techniques and see how far I could get into a large scale game project while also building my skills as a Unity developer.
I used procedural generation to generate a tile based overworld, cave systems, and towns for the player to explore. To obtain quests, the player would talk to townspeople, where a set of variables would be randomized to effectively get the player to travel to a certain location and complete some task before returning. This task usually involved defeating some kind of monster.
Example of an early full size overworld in Infasy
Infasy was developed in Unity 2017.1. As a result, there was no native support for tilemaps, which was added in 2017.2. As a solution, I developed my own tilemap system. Each tile in Infasy consisted of multiple layers: a background, a midground, and a foreground. Entities such as the player, NPCs, and monsters resided on the same layer as the midground.
Due to the fact that all of Infasy happened in the same Unity scene, I divided all generated maps into chunks of a predetermined size in order to improve performance. The player's current chunk as well as its 8 neighboring chunks would remain loaded at all times. As the player approached a chunk boundary, chunks would be loaded and unloaded again in order to maintain this rule.
To generate the overworld of Infasy, I overlaid two layers of Perlin noise on top of each other based on a world seed. On layer representing elevation, and the other representing climate. All tiles below a predetermined elevation were filled with water, and all other tiles became a certain biome based on predefined ranges of elevation and climate.
After lots of experimenting to find a consistent results I liked, I then learned how to expand my implementation to apply Perlin noise in 3D space to create a 2D map that wrapped around itself. From then on, players could walk East to West across the world of Infasy as long as they pleased.
Multiple subsections of different overworlds used for comparison during development
An example of a final result of Infasy's cellular automata before filling and cropping degenerate cave systems
Infasy utilized a form of cellular automata in its cave generation method. This was inspired by the famous cellular automaton, Conway's Game of Life, in which cells are killed or are born based on how many living neighbors they have after each step.
To accomplish an effective cave generation, I took this idea and modified it such that the parameters for a cell dying or being born after each step were slightly different. Additionally, the initial state of each cell was determined randomly, slightly favoring being dead. After a predetermined number of steps, the automaton was halted and each dead cell in the final result represented an open tile.
This process resulted in a large number of disconnected cave systems. To select a system to use as the final cave, I used flood fill to count the number of open tiles in each system and choose the largest one. The remaining cave systems were filled in and cropped out.
Check out Infasy's github repo!
Artwork for Infasy was provided by opengameart.org.