Listen server PIE disconnects client when starting PIE in world partitioned level

Hi,

I would like to know if this is a known issue:

Starting the editor with two clients and one acting as listen server, the client will randomly but with a high repro rate, disconnect from the server due to a visibility request on a package the server is not aware of.

At first it seemed to be an issue after an upgrade to 5.6 but looking at the code it seems this could be problematic on earlier versions as well.

The issue disappears with `net.SkipMissingLevelDisconnect=True` but we do not want to enable this CVar.

Cell names stored in `UWorldPartition::GeneratedLevelStreamingPackageNames` when starting PIE mismatch the package names determined during `UWorldPartitionRuntimeLevelStreamingCell::CreateLevelStreaming`, due to the world type being `Editor` when `PrepareEditorGameWorld()` is called, but `PIE` when `UWorldPartitionRuntimeLevelStreamingCell::CreateLevelStreaming` is called so `UWorldPartition::IsValidPackageName()` returns false.

`UWorldPartition::IsValidPackageName()` is called in `NetConnection.cpp::ValidateLevelVisibility` (`FLevelUtils::IsValidStreamingLevel()`).

On our end this is how we fixed it:

`Engine\Source\Runtime\Engine\Public\WorldPartition\WorldPartition.h`:

```

+ //Fix for listen server PIE disconnecting clients

+ public:

+ bool IsPIE() const { return bIsPIE; }

+

+ private:

//

```

`Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionLevelStreamingPolicy.cpp`:

```

FString UWorldPartitionLevelStreamingPolicy::GetCellPackagePath(const FName& InCellName, const UWorld* InWorld)

{

+ // Fix for listen server PIE disconnecting clients

+ const bool bIsPIE = InWorld->GetWorldPartition()->IsPIE();

+ if (InWorld->IsGameWorld() || bIsPIE)

+ //

{

+ // Fix for listen server PIE disconnecting clients

+ if (InWorld->IsPlayInEditor() || InWorld->IsPlayInPreview() || bIsPIE)

+ //

{

  // Set as memory package to avoid wasting time in FPackageName::DoesPackageExist

  return FString::Printf(TEXT("/Memory/%s\_%s"), \*FPackageName::GetShortName(InWorld\-\>GetPackage()), \*InCellName.ToString());

}



// This is for non\-PIE mode in editor, such as with \-game and \-server. It kind of mimics OFPAs being

// flattened into the level list upon cooking.

return FString::Printf(TEXT("%s/%s"), \*InWorld\-\>GetPackage()\-\>GetName(), \*InCellName.ToString());

}

return FString::Printf(TEXT(“/%s”), *InCellName.ToString());

}

```

Please let me know if you create an issue for this so we can remove the engine change when it is addressed in a future version and if you see an issue with our fix.

Thanks in advance,

Hugo

Hi Hugo, thanks for reporting this issue!

I’m trying to repro this but had no luck so far…

Are you using the option to run the server in another process ? Maybe share a screenshot of your PIE settings ?

All in all, the change looks good, I just wish I could reproduce it before fixing it from our side :slight_smile:

Thanks again,

Sebastien

Did another run trying to repro and I couldn’t…

There were other fixes to the engine so it might have been solved already!

I’ll close this issue for now, if you have any more problems feel free to reopen it!

Thanks,

Sebastien

Hi Sebastien,

Here’s how PIE is setup: [Image Removed]Indeed, while initially investigating this I was not able to reproduce in the default Epic project that has world partition enabled.

This might be a timing issue, although the level where we were reproducing the issue is fairly simple (there is some PCG content in there so it might be related but not 100% sure..).

Best,

Hugo