Help needed with generating dungeon with pre-made rooms

Hello! In short, I’m trying to make a system where I can make spawn rooms, regular rooms, corridors and boss rooms all as different levels, and then create a dungeon using those premade levels, randomly choosing one from each of those categories to stream.

I have the randomly selecting part sorted using arrays, but my question is; how do I stream a level and place it at the door of the streamed room next to it? My doors aren’t in the same place for each room, the corridors aren’t straight, and I am not using a grid to spawn the levels so how would I go about getting the location of the doorframe in the previously streamed room, and then spawn a corridor or room piece to connect to that door?

I hope I made this clear enough, thanks in advance for any advice!

You can stream instances of levels at a specific point. Also, if you include a ‘spawn point’ actor in each level, you can use it’s location to know where to load the level.

I got as far as that, I streamed instances and in those levels, I have a “spawn point” blueprint actor in the centre of the door frames, but I can’t seem to cast or call those spawn point actors to get their location and rotation. What would be the best way of doing that?

Many ways of doing it, but one way would be to have a blueprint actor, a locator. When the player is about to walk into another room / level, they can find the locator nearest them with a sphere trace and get the transform of the level like this:

I see how this would work, but I wanted it to generate the rooms fully before the player spawns. What way would I call it as it spawns before the player spawns in?

Ah, you didn’t say that :wink:

You need to make each level responsible for connecting other levels to it.

So, have an actor in each level, it holds an array of the spawn points. When the level starts, it will pull in levels at each of the spawn points.

Each spawn point BP can hold many things. A transform, but also the type of level needed etc.

My bad haha, and ah so instead of having a blueprint that spawns the whole dungeon, I have a blueprint in each level that stores its’ spawn points, and then spawns the levels specified (i.e. corridors or other rooms) at its’ spawn points, so that one level spawning will trigger other levels to spawn, and each of them will then trigger more to spawn? I hope I’ve understood it correctly!

Thank you for the advice! I can see how I can get that working if I keep the blueprints in each level.
And yes, I know of that pack but buying it or checking it out seems to defeat the purpose of putting the system together myself haha.

Yes, that’s right :slight_smile:

You’ll find it a lot easier to embed the ‘dungeon intelligence’ in all the levels, rather than trying to write one enormous blueprint.

Incidentally, if you’re into spawning dungeons, I don’t know if you’ve seen this:

I know you want to make your own thing, but that demo is worth seeing :wink: