Optimizing Procedural Level Generation?

Hey all, I got a random dungeon generator I have been working on for a while and I’m finally at a stage where it’s play-testable.

It works by generating a starter room, the player goes through any door that generates, and then hallways connect other rooms, etc, etc, forever.

The rooms generate doors, which lead to halls. The halls unload the previous room and spawn the next. And it compounds as the player moves through. At most there is 1 room currently loaded(wherever the player currently is).

My biggest issue is that even when I set it to a base room and hallway setup. (Literally walls and a floor and some doors) It hitches and lags when generating the next room and lags when destroying the previous.

This has me thinking either something is inherently flawed or this needs heavy rework/optimization. The rooms are actor bps that are made out of HISM Components so at most it is only 3 drawcalls per room. (Wall HISMC, Floor HISMC, Ceiling HISMC).

Is there any way to optimize a specific bp? The game’s “Loading Screen” are essentially the hallways between the rooms, my first idea was to somehow make each room take longer to generate, and it just finishes by the time the player reaches the room but I’d love for any tips or advice on how to accomplish this.

Especially since this is basically a 1st pass completed prototype.

Any tips, advice or help appreciated. Thanc.

Can you show what one of the rooms looks like? It sounds like it could just be static meshes actually, no point in having HISMs unless you need them ( although this is not what is causing the hitching ).

Just to get an idea of room complexity…

Sure thing.

This is from above the starter room pictured is the only room that will have the halls and base room generated. It is random how many doors or halls may generate off of this. Everyone else waits until a criteria is met before generating their hallways.

This is what the hallways look like, usually 1-10 tiles wide, and no more then 1-10 tall. Can be very long with many doors branching off of it.

This is what the rooms look like, just a large empty room. Made of tiles and then the doors are randomly placed and will generate halls off themselves when prompted.

There may be up to 500k instances in play at one time but I don’t think any room can get bigger then that.

The biggest rooms are 120 x 60 x 50 = 360k + area for the floor and ceiling being separate tiles as well.