On my PC.
So as
@nesrocks stated, this is done in quite some games. Without a particular idea of what type of game you were thinking of applying this in I can only give slight variations on the same technique (since it doesn't really vary that much when you have pre-built assets).
So the premise here is simple:
- You have some well designed elements that you have pre-built
- You want to pair them with either some procedurally generated content, or just glue them all together procedurally
Before I go any further, take note of
The Three Hundred Project. It has a lot of ideas regarding procedural generation, some of which mention pre-fabricated assets. You can also
Google a lot of
things about procedural generation.
So, taking a Zelda-esque approach imagine you want a dungeon with lots of rooms to play around with. As I stated earlier, you might generate a layout procedurally (a grid with a bunch of abstract rooms represented by the connections to their neighbors). You now want to populate this dungeon. If you just want to use pre-built assets, then you will probably iterate through a few random assets, selecting the ones that fit the dungeon. This is one approach, but it gets boring quite fast since it is bound to get a lot repetitive. You can then maybe apply some transformation to the pre-built assets. Rotate them, mirror them and whatnot. This provides a bit more variety, but at its core it will still be repetitive, as well as in order to do this you probably have to stick to the centered door approach (as
@nesrocks stated). One way you can further improve this is by subdividing each room into quarters. Now you have to layout your connections across ~4x the space and each room will be composed of 4 different pre-built assets. This also eliminates centered connections, since each room will have a maximum of two connections per side, but it will also have a maximum of 4 inner connections. If your pre-built assets are flexible, then you can apply a second pass to the dungeon and eliminate entire walls connecting internal parts of the room, so it looks more like an actual room. Maybe you can even apply this across rooms and have a really complex layout.
However, this is using strictly pre-built assets (although that last suggestion involved modifying them at runtime a bit). Yet, you can look at it from another spectrum: Your pre-built assets are just well tested puzzles or story-driven components, so you do not want to generate the entire dungeon from them, just feature some of them in it. This means you can procedurally generate both the layout and the actual contents. But instead of generating key story rooms or puzzles, you'd just plug a pre-built one instead (if pre-built assets are themable then it's even better, since the same puzzle can appear in two different dungeons, just that it shows up in one as a regular room and on another with the lava theme and mirrored on the x-axis).
Hopefully this example has given you enough slight variations on the subject so that you can start developing your own techniques for it.
EDIT: This is not even getting into some more advanced techniques, like noise-dependent generation and so forth.
If you need an actual example, I might whip something up upon a few days after your request.
Cheers,
Rui Rosário