How is procedural generation used

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mustafamax

Hello
How is procedural generation
Is the entire map being generated at the start of the scene?
Or partially generated when the player is walking?

:bust_in_silhouette: Reply From: Hoimar

That depends on your use case.

if you want to create a little RPG world, say a dungeon or something similar, that could easily be done in one go when the game starts up.

For huge, “endless” procedural worlds like Minecraft, you’ll usually generate the specific parts of the world around the player (also called chunks) on the fly and unload these when the player is far enough away, for memory and performance reasons.

Exactly what I want is the second point
Are there ideas about generating the map piece by piece

mustafamax | 2021-04-15 18:14

A basic setup would be to have some kind of world manager that holds a list of chunks and their positions. A chunk could be e.g. a scene that you instantiate.
(You can use OpenSimplexNoise to get seamless terrain height.) From your post history, I see that you are already doing that, which is great.
Now you’d need to expand this concept to chunks. Each chunk should be able to generate itself. You can check the player position to see if he’s getting close enough to a new chunk “grid” and generate new chunks acordingly. There are also open source projects doing that, I didn’t check these extensively though, so your mileage may vary. By the way, search engines are powerful tools, use them! :wink:

Hoimar | 2021-04-15 18:29

Thank you
I know about these sources
But I didn’t check it well
Because of the confusion that occurs when reading a code that I did not write with my hand

mustafamax | 2021-04-15 18:57