Infinitely spawning Level

I’ve been working on a game where one of the levels is an infinitely spawning Library, every room is the same, however the books in the room all have randomly generated text in them, based on object coords. I need to create a blueprint that spawns theses small cubic rooms around you in a grid, and also deletes them as you go away from them to help performance. I am very new to UE5, I don’t understand a lot of the syntaxes for the blueprint coding system however I can grasp the logical sense of it. If anyone has the time to help me I would be very grateful.

This kind of thing crops up a lot. You basically make a room blueprint which has collision volumes near the doors. When they player overlaps, you spawn the next room. When the player goes into the next room, you can remove the first.

This assumes there are doors. If you can see from room to room, it’s a bit more complicated, because you need to keep more than one room in the level.

The level I am using has no doors, so you will be able to see multiple rooms at the same time, one Idea I had was to create some type of grid of non-exsistent rooms outside of the room the player is currently in, but only when the player steps into them they actually load, I just don’t know how to actually make this work :I

1 Like

Very tough… If you can see through multiple rooms, then you also have the problem ( much worse one ), of making sure you don’t spawn rooms on top of each other.

Making them spawn is easy, just have an overlap on the exits :slight_smile:

The other approach is to make them all at once, and keep them apart. But that’s obviously not a performant.

I managed to get it working, well working might be a stretch, however I haven’t found any bugs expect for the obvious, it cant remove rooms, thats a problem for later me.

Too anyone in the future finding this, enjoy deciphering these images.



All this code will go into a bp actor, then the room that you want to spawn from it will be a child of this actor, the array type is a “scene component” btw.

Once I get the delete function working I’ll post it, but honestly you probably don’t need it if you plan on making your rooms quite large.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.