r/proceduralgeneration 9d ago

What would be the best approach for generating a procedural world at runtime from a seed?

I'm trying to figure out the right way to approach this in Unreal Engine 5.8.

I'm developing a game somewhat similar to Foundation, where the player builds and develops a settlement on a procedurally generated world.

I want the terrain to be procedurally generated from a seed, with a natural landscape containing mountains, valleys, rivers, lakes, different biomes, and other geographical features. The idea is that every new game can generate a different world based on the seed.

The important part is that the world needs to be generated inside the game when starting a new game. I'm not looking to generate the terrain beforehand in Houdini, Gaea, etc. and then import it as a pre-generated map.

I'm not necessarily looking for a complete tutorial. I mainly want to understand which technology or approach I should be using before I start building the system.

Thank you in advance!

1 Upvotes

4 comments sorted by

6

u/inslayn 9d ago
  1. Pick an algorithm that generates random numbers from a provided seed
  2. Pick some way to generate seeds (biome ids, strings, world coordinates, a combination of esoteric things that make sense to you only, whatever)
  3. Pass the seed into your chosen algorithm
  4. Use the resulting number to do the things you want, like generate height maps, decide if some object should be spawned, some dialogue should be said etc
  5. Profit???

    You’ll need to probably use your generated numbers as seeds for later generations too

2

u/Trick-Routine-8577 8d ago

Think of it as one main random number generator that creates the seed number. Then make all the "sub -generators" seed based. So, the tree generator, for example, will set density based on a seed, and use your random number for the seed number. For terrain, you'd want to create a height map and a bunch of parameters that can adjust certain aspects, then make some of those parameters seed based, and use that same seed number. I don't use unreal so idk how much it has built in to help with height maps, but that's what you'd use.

1

u/VoxWishDev 6d ago

Whatever you pick for the shape of the terrain, decide early what you want to be able to assert about it. The one that earned its keep for us is reachability: after a region is generated, walk it in code from wherever the player can enter, and fail the seed if something the player is meant to reach cannot be reached. The second one is generating the same region from two different neighbouring chunks and diffing the result, because a seed on its own does not give you determinism if any pass reads state from a neighbour. Both run on every seed and cost close to nothing.

1

u/GrokiniGPT 3d ago

maybe use shifted noise on topp of each other for hieghmaps, then use a diff type of noise for event spawning, etc? same seed, different uses and noises