How do I make a Dungeon Keeper Map Generator with premade meshes?

So I have started to make a Dungeon Keeper game. its not a game for release but just a way for me to have a goal while learning. but the moment I started I got hit with a roadblock called “world generation”. So I like many others started with generating the map using hundreds of blocks. After that I made a system that updates block side rendering, but as you know that is a really bad way of generating a world and I found it out the hard way.

After the disappointment that this script was and playing around in blender I started to research on how to optimize the map and found that a lot of people use scripts that generate mashes on the fly and turns them into one gameobject and thats where my problem comes in.

In this game i need two things from the system:

  1. Make so sides of blocks update depending on what is right next to them. If a building is placed right next to them they need to change their mesh. But it cant only be one type of mesh that it sets itself to because i need custom variety like every third block has a torch. Neither can it be only a static mesh because ill be stuck if i needed a intractable book on it or something like that.

  2. After the map is created i need to be able to manage all of the tiles in a map with an probably static array. That includes both empty spaces, rocks, water and especially the ones filled with “buildings”. this would simply allow me to make a dinging and building system for these tiles.

And even if you cant explain how to do it i would appreciate any guidance on how to find it myself like a link to an article about prefab world generation or something. Thank you for reading this out and hopefully helping me!

PS: here are my [|152605]