Procedural rooms in the same project?

Hello everyone,

Is there any way for me to take a selection of blueprints/meshes and proceduraly generate them (X;Y;Z away from the spot) by walking on a spot?
Or even copy and spawn the meshes and blueprints used/created in the project?

I don’t want to use for example corridors and make a new room but just Teleport to and create a new room from overlaping an object/door or else.

PS : all of this made in game, not a project to copy/paste things but playing a game and an object “spawn/create” a new room.

I have a plugin that does exactly that (and a whole lot more) - it’s almost ready for the marketplace - keep an eye out for “rdBPtools”…

I would prefer to learn doing it myself even if it takes lots of time. I am a beginner and try to learn the stuff that first really interest me so knowing stuff like this would really help me out in moving on with my knowledge :stuck_out_tongue:

I completely understand :slight_smile:

A good place to start would be playing with the “Convert Selection to Blueprint” command which makes a Blueprint from your actors and you can work with that…

But that was not the question ^^’

Once you’ve got that blueprint, you can add a TriggerBox to show/hide or move that Blueprint.

But it’s not the question… again

Perhaps you could clarify the question then please?

From my understanding of your question, you are wanting to spawn a room when you get to the door - is that not what you’re wanting?

If I have this for example, the room has random items spawning in it, have my player and few “doors”, if I step on them my character will move itself forward for a couple of feet.
I want this first to know what event or anything I need to do to Copy this room with the random objects randomize again after the teleport action. So litteraly copy/paste a new room of the same size with new “doors” and a way to go back if going through the same door.

Yes I think we’re on the same page.

The reason why I suggest using a Blueprint for the whole room is that you would procedurally generate those random “clutter” items from the Blueprint - google “procedural clutter” to find more on that.

Also, you add “BoxTriggers” to the door areas in that Blueprint and add code to the “Begin Overlap” events in the “Events” section to move your character and to spawn a new version of this Blueprint at the appropriate location (you can add a Vector variable to the Blueprint, and tick “Instance Editable” and “Show 3D widget” to make an easy way to position it in the level.

image

Also, check out the following link for more information about triggers:

The other bit of code you’ll need is a way to make those rooms the same each time - google “UE4 RandomStream” and “Setting RandomStream Seed” - when you set a “Seed” for the randomstream - the random numbers it generates (for the clutter) will always be the same, if you look at the first 10 results from the randomstream with a Seed of “0” - they will repeat each time the RandomStream is Initialized. If you Assign a Seed for each room, that ensures they will be the same each time you enter them.

For an idea of the type of randomization you can do with the RandomStreams:

I am here for few hours already and still don’t see much things of what I needed to google so I tried my stuff, I could spawn the whole map again few meter away but it would TP me out of it or not spawn a floor first.
So I tried a different way and make a clutter out of the whole map I’ve made just to see if everything would just spawn on itself (without randomness) but nothing spawns.

I did my whole map as a blueprint which doesn’t seem to like the blue prints with Random spawns in it so I got rid of them because it’s not yet the problem.

Now I am stuck because I don’t understand most of what you said as Seed stream doesn’t seem to help or what should I do with it? Beside seeing if the numbers are the same each time?

I know about the trigger actors from the beginning when I started with this program.

Putting a velocity into spawning the room on the arrow doesn’t seem to work as I don’t have any return target because the blueprint doesn’t allow it.

Spawning actors can actually be quite tricky to get right - it’s taken me months to get to a point where I’m happy with my system - but maybe I can share some tricks:

First - don’t actually spawn new actors - use “AddChildActorComponent” - that way the actors you create belong to the Blueprint from which your creating them, and are deleted at construction - and are moved/hidden/shown etc with that Blueprint.

Set the class in that last node to the type of actor you’re wanting to spawn.

Ignore the things I said about random for now - that can be added later - it sounds like the most important thing for you first is to get those actors being created from a Blueprint.

If you’ve still got your spawn code, perhaps try replacing the “SpawnActor” parts with the “AddChildActorComponent” nodes instead…