GMS 2 Automatically fill room with tiles from different tilesets with extra conditions


Dear Community,

I am at the start of my GMS2 career :) and trying to start with a project "similar" to the game motherload. At least this should be the scope in the beginning
I can not put my request in correct terms. I guess, thats why I cannot find useful reference in the forum / youtube.

The basic principle is: My o_Player is represented by a driller and it has the desire to mine whatever he can :) There are different materials which can be mined if the right upgrades are bought. The deeper you go. The better stuff you can mine.

Right now I have multiple cool things already in place.
1.) Player with animated sprites which moves on a grid and can mine ressources (tiles) within the respective grid positions
2.) A room in which I (manually) inserted tiles from different tilesets (eg. Stone-Tileset, Gold-Tileset, etc.)
3.) Set up a collision detection between the player and the tiles. Depending on the tileset, different things "happen". X can not be drilled, Y needs an upgrade of the driller, Z need even more driller upgrades...etc. If you can mine it, you get ressources.
4.) I have a small shop in which you can buy the upgrades and fuel.
So far so good :cool:

The next cool step for me would be to create the level (room) at random.
So random tiles, from random tilesets should be picked an placed within the grid under the "surface" (fixed y value?!). The different tilesets seem to be necessary to me, to be able to perform stuff mentioned at 3.) I am totally fine if anyone tells me, that my approach is not good! Just hit me :)
The random world gen. videos in which "only" walls get placed at random do not fit for this task. I am not placing objects and not only random tiles from one tileset.

Additionally I want to be able to set the probability of "spawning" the different tilesets depending on the y coordinates in the grid / room. (Taking randomized tiles within the tileset would be the cherry on the cake)
For example: On y = 0 dirt should be placed in 50% of the tiles. Stone 30%. Iron 15%. Gold 5%. at y = 500 there should be only 5% dirt. 50% stone...1% diamond, etc..

I would really appreciate if anyone could give me a hint on how to start this "randomly generated room from tiles from different tilesets with different probabilities to be placed"
tell me that my approach is not good (and why) and what would be better to do.

Thank you so much in advance!