random 2d terrain generation

Hello everyone.

I’m making a 2d platformer game, and because I’m lazy I don’t want to create levels myself so I want to make a random terrain generator xD.

Joking: I want to make a random 2d terrain generator that would create something like this, and with the possibility to make caves and other underground terrains like this. I’ve studied the internet for weeks to find methods to do this, but I find it really difficult to get started.

I have something in mind:

  1. generate a map in form of a dictionary -------------> 2. realise the map.
  2. or load a pre-made map like a boss-room __/

***1:
The (randomly generated) map would look like this:

{'1, 5': 'stone', '2, 5': 'stone', '2, 14': 'flyingBlock'}

The key represents the coordinates (x, z), and the value represents the block.


2:
When realising the map I’ll make a function that checks if blocks can be combined to spawn as less as possible objects and verts. (I don’t need help with this…)



I actually need help with getting started with making a function that creates the map that has enough space everywhere to walk and jump and shooting arrows and stuff.

I tried to explain my idea and problem as clear as possible xD, I hope you can help me.
Thanks