#01 - World Generation Foundation
Creating an infinite world always seemed like such a daunting task. Random infinite sequences are easy, but making something that looks like it was crafted? With maths? That's nuts. I knew the fundamentals of using perlin noise or wave function collapse to generate realistic(ish) terrain, but putting it into practice requires consideration of so many variables. But then you get nothing done without starting.
Initially I was just working with elevation representation on a tilemap in Unity. With a palette of 6 tiles ranging from black to white, I could generate perlin noise with different configurations and visualise the output in real time. There so so many tutorials out there to get you started, and once you wrap your head around it, you realise the amount of potential applications perlin noise has in your game.
Already this was looking pretty good. If I was just making an endless world of rock, the world gen phase of development would be over, but I wanted biomes.
I watched a lecture from Henrik Kniberg on YouTube about Minecraft world generation, in which they use temperature and humidity to determine biomes. By layering two perlin noise maps together, each measure these metrics, they end up with a diverse and logical biome distribution across the world, and I thought that was brilliant. I tried to come up with my own way of doing it, but surrendered the their genius and employed temperature and precipitation, along with elevation and erosion as the initial four main perlin noise maps that would generate my world.
I created a table of biomes to start with that I could generate based on these measures, and created a scriptable object with scalable variables to draw from, including tile(s) to render on the tilemap. I centralised the world generation in a world engine script that would generate the biome distribution and topology in separate functions, so that they can adjust to each other. I'm yet to employ the topology, but the biome distribution seems to work quite nicely.
You can check out the code HERE. But there is still so much more to do.
Firstly, not all the biomes have been implemented, and it will require some refactoring to eliminate the hardcoded biome table, but that's on the list of things to sort out.
I also want to employ a new layer of perlin noise to create a sort of continent system, so that I can have more realistic terrain, ocean, mountain formations, and rivers. The arbitrary placement of water, lakes, ponds, and rivers in procedurally generated games has always rubbed me the wrong way, so I'd like to at least try and do it with some logic and reason. This also means bringing the existing topology methods into the mix, which could be difficult to juggle but I reckon the outcome would be worthwhile.
I do have a chunk system already in place, with 32x32 tiles being independent game object that load and unload based on the player position with incorporated view distance, but this relies on mathematically consistent world generation so, particularly with systems like erosion, I need to ensure that nothing is random.
The hard cut lines in biome splits is a bit of a red flag to me as well though, as can be seen on the right hand of the above screenshot, so maybe I need to include further variables to generate biomes in a more naturalistic way.
This is proving to be a difficult, albeit engaging, problem. Hardly one I'm prepared to walk away from though!
---
That's all for now. Until the next time, take care.
Khôra
A top down 2.5D pixel survival sandbox & eco-sim.
Status | In development |
Author | Dormarr |
Genre | Simulation, Survival |
Tags | 2D, Indie, Open Source, Open World, Pixel Art, Sandbox |
More posts
- #06 Terrain Texturing44 days ago
- #05 Colour Mapping Tiles49 days ago
- #04 - Natural Features75 days ago
- #03 - Expanding Biomes80 days ago
- #02 - Prelim Artwork84 days ago
- #00 - Initial Ideas & Concepts84 days ago
Leave a comment
Log in with itch.io to leave a comment.