Level transitions with procedural level generation

I’m new to UE having used Unity for a few years, so feel free to assume I am ignorant of everything. I’m experimenting with developing a procedurally generated dungeon crawl, using multiple small levels connected by stairs. At the moment I have a 2D tile map generator (c++) and I’m fairly sure I can create a 3D environment of blueprinted tiles from it. I would like the game to run as a 4 player coop hosted by one of the players.

My question is: What is the best approach for loading the levels for the players? Ideally I would like to stream in new levels as each client demands them (e.g. trigger near staircases) and unload them when they are no longer needed (no player within 1 level of them).

I see the most basic solution as a single live level with a transition and the requirement for all players to be on the same level (“You must gather your party before adventuring forth!”), but I would like something more sophisticated so they can roam around a bit more independently.

I’m using UE5 and I have seen the level streaming docs, but I thought I would get some opinions before I delve further. I’m not really looking for code, more suggestions of approaches and key words I can research around. I am particularly interested in how I tie together procedural generation on multiple levels, networking and level transition. Thanks!

If the areas are fairly focused, you can do it with loading and unloading blueprints. ( You could also make sublevels, and decide randomly which you are going to stream ).

The problem lies in the ‘multiplayer’ part.

You have to let them wander freely. That means that they will all be in different positions simultaneously. But… once player 1 has visited ‘Area A’, when player 2 ventures into that area, it needs to be the same position etc. That’s the problem.

The system has to pass level info back and forth, and you have the synchronization problem.

Good points: I thought I would create most of the level data client side and only replicate doors, containers and mobs. I was planning to spawn and de-spawn mobs dynamically based on player locations, but I do not know how this would play with everything else yet.

I’m keen not to re-invent anything that I can use already, but I don’t know enough to be sure what will work :slight_smile: Can I create a sublevel dynamically in code and connect this to the level streamer? Edit: I realise that sounds weird… I mean I would dynamically create many sub-levels at game start and then stream them later.

No ( unless you’re very excited about spending a long time in the bowels of the engine ), you need to have the levels made previously. To be clear, they aren’t whole levels, just pieces / one room etc, which you can stream in behind a door, for example.

Like I say, also spawning a blueprint is also an option. Then at least you get the functionality with the thing you just made.

My game contained a procedural maze which was just BPs spawning each other.

Thanks, I really appreciate your thoughts. I’m leaning to having a single non-streaming level space where I dynamically create and destroy my dungeon levels, and go back to the old method of forcing the players to move between levels as a group.

Have a good look around, as there are a lot of ways of creating parts of levels now, with 5.

Not an exhaustive list, but to name a few

  1. Level streaming ( using volumes or blueprints )

  2. Level instancing ( packed or not ).

  3. World partition

And of course, blueprints.

1 Like