Algorithmic World Generation

IanTheOne

Member
Heya coders! I was wondering how I would go about replicating the world generation presented in this video:
I tried to look for a way to go about procedural generation in the game I'm making and found this method, but...
I've found no methods about doing this type of generation, so I decided to ask the GMS forums since no one I asked knew how to do it, here's a rundown of the process:
  • It selects a random source image.
  • It creates a 2d array and sets all the "cells" to -1.
  • It then "scans" each cell and separates them by biome.
  • It sets the values to the value of the biome inside the 2d array according to the color of the pixels.
  • It creates random nodes on the array, expands them to two "unit sizes" and deletes them.
  • It loops through each unit surrounding a biome, for example, a desert biome and checks for certain conditions which is: "It has one or more neighbor unit with the desert biome"
  • Each one of these pixels meeting this condition has a 1 in 3 chance of becoming an actual unit.
  • Repeat this process one more time.
  • Then it checks if any cell has 8 neighbors in all directions(that is vertically and cardinally) and deletes them.
  • That's the biome generation done.
Then it creates room on each cell that isn't empty(set to -1) and gives the rooms certain attributes:
  • Seed;
  • Type;
  • Biome Type;
  • Exits (whether it's connected to any other rooms);
  • State (whether it has been discovered or not);
  • Clear (if it has been cleared);
  • And special attributes for rare events and stuff.
You may be wondering: "If you have the whole process figured out why don't you just get to coding?" Well, its cause I have no idea how to do most of this stuff, this is why I have decided to ask help from you the GM community!
Even if you don't know how to help me it would still really help if you'd share this topic to someone who might know how to help me.

Thank you for your time!

Ian--
 

Simon Gust

Member
If you don't know how to do it, then you already know what to do. The mountain you want to climb is very steep and there is no other way around than to learn how to do things. We are not going to walk you through it, this is your part. What we can do is pretty much the same as the video showed, explaining the concept. If we were to just show solutions, you'd be stuck right after implementing it because you still wouldn't know where to go from there. We will help you, but you've got to work first.

We want you to become a good programmer, not do programming work for you.


The video spoke of terms you should familiarize with such as:
- arrays
- buffers
- surfaces
- enums
- loops

If you understand what they do and how you can use them, then you can start making a worldgen framework such as his, or any worldgen framework in general.

A good resource for learning is always the manual, it gives you a rundown and a small example of what certain functions do. There are also a lot of tutorials here explaining world gen using the terms given above.
 
Top