Multiple UWorlds and Actor Synchronisation

  1. Is it possible to create two distinct UWorlds, within one game, which can run at the same time? To be more precise: What is the current state of UE4 supporting this?

  2. If possible: How would I setup synchronization between those two worlds?

  3. If possible: Where would I put C++ (Blueprint) code to initialize more worlds and communication between them?

For example: In UWorld1 an Actor A1 moves around. In UWorld2 an Actor A2 exists which should receive those movement events from A1 and position itself accordingly.

What I did so far is 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[i];
		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 stacktrace which I attached. The game runs for a couple of seconds and then crashes for good.link text

I also created a forum thread: link text