Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

What Frontline Studios said is basically correct, although in practice it’s much more involved. Because none of us know what you mean by “messing it up”, only vague advice can be given.

Firstly, for performance reasons you want to divide your world into chunks of some size. It’s usually a power-of-two but it doesn’t matter too much. You should keep only chunks closest to the player loaded. That means when a player comes close enough to an unloaded chunk, that is when you load it. Same thing for the opposite.

The way you generate your chunk usually relies on a whole bunch of noise functions that’s mixed together, but you should be able to get something recognizable with a single Perlin noise. After that, you come up with the logic yourself. Water is always generated at a height level <= 0; if you generate a dirt block and there’s air above it, then it’s actually grass, etc.

Structures that spawn across chunk boundaries are a different topic.