I recently started making a 2D survival game but I don't know how to make a randomized world generation, so when a player creates a new world It generates it.
I need an algorithm that makes the world in a pattern, where the player can also choose the world size and it has a variety of ground levels (like ground,underground,caverns etc.), and it generates with a block style like Terraria (there's a simple grid)
I also would appreciate if someone would find a way to make the world pseudo-round (eg. when you start the game you go to the right and once you breach the end of the world, you step on the first block on the left side. Also that the generator makes the world randomly, except for the starting point that is setup.