This week, I’ve been trying to figure out the best way to determine where settlements like Cottages and Towns will be spawning in a procedurally generated world.
I’d like to have some trade routes eventually – or people at one settlement aware of the ones that can be reached nearby so they know where to generate procedural quests at – or some other form of connectivity.
So I figured I’d use the perlin noise to also help create predictable settlement spawn points.
It makes sense to me to spawn next to seas and mountains, as those would be resource rich areas. So I wrote some code that identifies those areas.
Then I wanted these isolated loops of hexes to be connected. Rather than find the shortest routes and make straight lines, I created an offset of perlin noise and created “invisible lakes” with it by defining the value that would be the edge of the lake. Then I traced around those the same way I do with the real lakes and mountains. The result is windy paths that intersect most of these sea and mountain paths.
Intersections of these make the most sense for settlement locations, as an intersection suggests higher traffic of travelers along paths. At each intersection, the hex has its perlin noise value from the offset noise I laid down. I chose a low range of values for the site of cottages, and a high range of values for the site of towns. I have a significant range left over for other types of settlements I might decide to add.
After that, my computer crashed, and I spent a day trying to get Unity to start again. Their customer service is excellent, however, and they got me up and running with just one email of suggestions.
Downloads and Ratings
I’m also celebrating my 1,000th download of Sverdheim this weekend! I had added it early to the itch.io Bundle for Racial Justice and Equality, which single handedly boosted me from just 100 downloads. I am in awe that so many people gave this simple little game a try.
And with that, I got my first 2 star rating, for being a “Totally bizarre roguelike game.” I think it’s a funny rating, but I hope it doesn’t discourage others from giving the game a try, and maybe leaving ratings of their own.