State of multiple UWorlds


what is the current state of supporting multiple UWorlds within one game instance?

Some older threads discussing this do exists. The last official statement on that feature I could find was in the release notes of 4.11. The status in those discussion is that it is highly experimental.

Maybe someone has some recent information on.

Thank you and regards.

Take a look at UT code, it actually creates a separate UWorld for the replay world.

What were you hoping to achieve with multiple world support?

I made a simple test project that allows me to switch between multiple worlds, offline at least.
I keep meaning to sit down and work on adding multiplayer support, but am yet to find the time.
If this is what you are after, I am happy enough to share.
Not really that much to it.

Note: I did a cross post to AnswersHub:

I have a large world with one single level. I am thinking of using separate UWorlds to create detailed/to-scale maps of selected areas/interiors of that world. For now I am using separate sub-levels within the persistent level. Those are also persistent since the simulation there is essential for the whole game.

But this approach is limiting and needs some trickery to hide those levels from the player. So I started evaluating using multiple UWorlds. In each UWorld I then would run an detailed/to-scale sub-game and sync essential data between the main UWorld and all Sub-UWorlds.

So I guess, the goal is to have multiple persistent simulations which need to exists during the complete time of a match, are semi-independent and don’t conflict in regards to physics/levels.

So now I am evaluating using multiple UWorlds. How do they work, what is the state, how to integrate them with each other and what UE4 code maybe needs to be adapted. Documentation is very scarce so I am posting in this forum.

What I did so far is just this:

void SomeClass::SomeFunc()
 FString PackageName = TEXT("/Game/Subfolder/NewWorld");
 UPackage* Package = CreatePackage(NULL, *PackageName);
 UWorld* NewWorld = GetWorld()->CreateWorld(EWorldType::None, true, FName("TestWorld"), Package, true, ERHIFeatureLevel::SM5);
 if (NewWorld != NULL) {
     UE_LOG(LogTemp, Warning, TEXT("Created UWorld."));
     TArray<ULevel*> LevelList = NewWorld->GetLevels();
     for (int i = 0; i < LevelList.Num(); i++) {
         ULevel *OneLevel = LevelList*;
         UE_LOG(LogTemp, Warning, TEXT("Found a level in new UWorld."));
     return true;
 return false;

This code runs in principle and creates a new UWorld. However:

  • I have to provide an extra content folder ‘FString PackageName = TEXT(“/Game/Subfolder/NewWorld”);’] which does not contain assets referenced/used from within the default UWorld.

  • The first time I BeginPlay the game works. Then I stop playing and hit play again in the editor; I get a stack-trace which I attached. The game runs for a couple of seconds and then crashes for good.

Do you have to sync them at all times or can it be done when you switch between worlds?
As for the code, it does appear to be loading any actual content or registering the world with the engine correctly.

Busy this morning, but I will try to get what I have together in a meaningful way so I can share it.
Please bear with me :slight_smile:

I can see a point for multiple UWorlds within single instance (when hosting on AWS or azure it’s not a problem, I can always spin up more servers).
Since world is limited to 20x20km area there is no way to reliably simulate AI (for example), past this distance. With multiple UWorld It could be easier to split world into sub worlds, and still run some rudimetary simulations over entire world.
Though I’m not really sure if kind of mega coordinate system wouldn’t be better and simpler to maintain in long run…

Kris,hi!Can you share the code of Multiple Worlds!Thanks

The stacktrace show that your UWorld get destroyed because of this condition.

if (!bCreatingCDO && (!bCanRecycleSubobjects || !Obj->IsDefaultSubobject()))

If I understand the code correctly, Your newly created UWorld is subobject of something.
The code think that your subobject will probably come from constructor later, so it decides to destroy your newly created UWorld to prevent unnecessary uobject.

Good question… Its got to be somewhere around here…

Would you mind sharing the code then? Or at least provide some details how did you manage to get it done?
For me the engine is freezing, and unable to load a level as the editor crashes.