Client load level instance causes disconnect

I made a clientside level stream for random landscapes that only serve as a background. The problem is that the client loses connection when it loads an instance of a level that server doesn’t have. When the server loads an instance and tells the client to load the same instance it works fine. In most cases server will not have the level loaded. Is there some sort of validation when a client loads a level instance?



Solution is for C++ only :frowning:
I kept digging in the engine and found a quick way to fix the problem, here it is implemented to suit my needs:

bool AClass::ALevelLoadingFunction()
bool bLevelLoaded = false;

     FString OutLevelName;
     if (GetRandomLandscapeName(OutLevelName))
                     // The following function is BlueprintImplementable and returns pointer to ULevelStreamKismet
             LevelStreamKismet = LoadLandscapeLevelInstance(OutLevelName, GetActorLocation(), GetActorRotation(), bLevelLoaded);

             LevelStreamKismet->bIsStatic = true;
             LevelStreamKismet->OnLevelLoaded.AddDynamic(this, &AClass::OnLevelStreamLoaded);
     return bLevelLoaded;


void AClass::OnLevelStreamLoaded()
if (LevelStreamKismet->GetLoadedLevel())
LevelStreamKismet->GetLoadedLevel()->bClientOnlyVisible = true;
ULib::QuickDebug(“Loaded”, false);

Hi there!

Thanks for sharing your solution!

For anyone looking for another way, that doesn’t require C++, please understand the issue here is one of Cheat-protection built into UE4 that has to be honored rather than ignored until Epic changes the cheat protection policy.

I’ve posted more info here:

**The Solution**

1. ue4 will kick client if client tries to load a map with a name that is not in the server list

2.solution is therefore to ensure that server loads the map instance with that exact name before the client does, even if it is only by a moment

3. Therefore, if client wants load level

4. Have client call the server to ask server to load it and rep that function to then load on the client **with exact same name** knowing it will be after the server loaded it :)



@Rama You’re a life saver, man. Thank you so much for sharing your solution–it saved my skin!

@Rama thank you for your suggestion. But in my case the server is already in the level that the client is going to load. In particular it is a sublevel with streaming method always loaded. On some clients (those with AR) I hide the sublevel and let the user tap to decide where to spawn it. After that, I re-load the level instance in the new position. Unfortunately I get the disconnect problem as well.
As an alternative I tried hiding, changing the level transform, and showing it (client side) but that did not work as well.

Is there any way to disable this Unreal anti cheat system? I’m developing something more like an app, than a game, and I don’t need this kind of restrictions.

@Rama I’ve tried using an authority switch in to load a multicast-replication for the server and a server-replication>multicast-replication for the client. This still doesn’t seem to help. Do not want to have to alter the C++ code. Anyone’s help is appreciated.

*Update: The best solution seems to be the Victory plugin:

Otherwise, the only way to get this to work, without C++, would be to create separate persistent levels and load them instead of the stream sub-levels.