Can PCG be used to stitch together level instances?

I’m trying to create a random dungeon generator using prebuilt rooms. I was currently looking into just using actor sockets and actor pivots and then spawning attached halls or rooms from those actors, but I’ve a few issues with rooms sometimes overlapping due to it spawning a room with a connector that could cause it to loop back around. Has anyone had any experience using PCG to try and stitch together premade rooms? This does need to happen at runtime.

I originally was using dungeon architect, but it constantly feels like I’m having to deal with compile bugs or issues with it and I’m a bit tired of it.

Open to other suggestions of course.

Hey there @Krileon! You can use level instances with PCG for this, though you’ll have to handle the spawning logic accurately to be able to have them organized correctly.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Yeah making sure they don’t overlap is my biggest concern. Haven’t fully worked that out yet. So far my solution is to make all my level instances the same size so it’s a static box size that’s already known.

One common path is to maintain a specific grid/unit size and have each module not necessarily the same size, but defined sizes like 1x1, 1x2, 2x2 etc. I generally do this without PCG however.

How do you deal with collisions when doing that? I had the idea of using level instances. Each level instance would define connection actors, which would spawn a new level instance connecting the two rooms. Only real issue there is dealing with room collisions so that’s why I figured static grid size would be necessary, but maybe just doing some line traces to pre-check for collisions is enough.