Is it possible to create new levels from inside blueprints?

I’m trying to make a system kinda similar to the one used in Minecraft where you have a “create new world” button and it makes you new worlds depending on the parameters you choose but for now I just wanna make a button that creates new empty levels when clicked is this even possible?

Just make an empty level and generate the meshes dynamically.

can you explain that in more detail please?

It’s a rather broad subject. Basically you need to spawn the cubes dynamically.
There are many tutorials and examples on the internet at this point. This one goes pretty in depth with the idea

I just want to create empty levels for now with no geometry or anything

Then just pick new level from the editor toolbar menu (probably in file) and pick empty when the popup shows

I don’t think you understand what I want exactly

again I want to create new empty levels with code from inside the blueprint

eg: a button when pressed creates a new empty level and sends you to it

In short in blueprints you can’t.
Perhaps in c++ you could use newObject(TEXT(“MyLevelName”)). It would need to be registered in the asset manager and saved to disk.

I think you have the wrong idea about how minecraft / any procedural game generates it’s levels.

You would just need an empty level (that can be reused for every seed) and from within this level you would call a manager that would generate the level’s geometry, logic & inhabitants (actors).

The only thing you might have in the level would be the manager (unless you go for a static blueprint library then you could just call it’s generate level function with a passed in level seed on begin play).

If you would be using multiplayer then the other player would load up the empty level and using the passed in seed generate his own level.

The empty level would just be a new level, with the manager saved in your content browser, nothing more.

excuse me I’m relatively new to this stuff but if I’m understanding this correctly I would just need one empty level and then I would just need to save the data of this level not the level itself and when the player loads a new world or a pre-existing one it loads that data and fills the level with it

The data would never be saved inside of the level.

You would need an algorithm that describes the level.

Your world bounds would be basically have a 3d limit of blocks. Each block would be part of a huge 3d grid.
The block position would be dictated by it’s index the higher the index the more offset the block would be. At some point the index would have to wrap around the to the start adding an index to the other axis (basically a 2 grid). Then you need to expand this to the 3d space (z axis) once your world slice is filled.

Then you need a function that can convert the index to x,y,z space.

So in your saved level you could then later gererate a string that would described which index is filled.

Then you would need a datatable with all types of blocks (dirt, rock, coal, diamonds etc)
each block would also need to know internally which block in the datatable describes it (it’s texture, properties etc).

The index to the datatable description would also need to be saved in the seed alongside the position

So block would be for example at index 6 and have properties 3
So all of the occupied blocks would form a long string (you can add extra delimiters if you want) that would a 100% describe how to recreate the level on clients.

You would need to encode to this seed string, and rebuild from it.

The client would then just feed this level description string into the empty level generator and it would build the level for them.

You would also need to add to the information sent to the player basic info about actors that inhabit the world (but that could be done through the replication system)

As for saving the information of the world to a server you would basically save only the current seed, actors and maybe the person’s inventory / chests to a database.