Whenever a client tries to stream a level in 4.15, the client is kicked from the host and loads the default loading map.
Replication:
Start a new 3rd person blueprint project, create a new level, add the level to the sub-level list, make the new level current, create a single mesh in the new level for proof of loading.
Add the following code:
Play game with 2 players, or 1 and dedicated server.
When the client loads the level, they are immediately kicked.
Loading on the server does not replicate to the client, and obviously manually streaming this causes a kick.
I am the author of that node that is in the engine, contributed via github: .com/EpicGames/UnrealEngine/pull/2320
It is not a bug, UE4 has code to prevent a client from loading a level that the Server has not loaded first. Presumably this is a security / cheating management decision, present in PlayerController.cpp
#Solution
To work around this, you just need to always load the level instance on the server first, with the exact same name.
#Request
I wish this security feature was optional, it makes certain aspects of dynamic level generation more complex/less stable because if there is even a slight timing difference, the client can get dcāed making this anti-cheat feature reduce overall capability of UE4 to be handle dynamic worlds without the developer having to worry about the chance of a client getting dcāed
The code is so embedded so as to prevent cheating that it is also impossible to work around.
As with all major engine decisions, it would be great if we as the developers had more control so that UE4 can play its role as dominant awesome engine of the world even better.
UE4 will kick client if client tries to load a map with a name that is not in the server list
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
Therefore, if client wants load level instead of server just doing stuff automatically
Have client call the server to ask server to load it and rep that function to then load on the client withexact same name knowing it will be after the server loaded it
Any news ? The problem is describe in this post
PlayerController.cpp line 317 : (World->StreamingLevels[i]->GetWorldAssetPackageFName() == InPackageName )
I can not find any fix for this issue :ā(
Hi,
Got the same problem on 4.18.2
I also did try to do what Rama say but i end with deconection or nothing display on clients. =/
No one have a working ātempā solution to share ?
Thanks
Lucky I found this thread as I was struggling to figure out why my client player kept not working when I introduced more lag. I am doing āLoadStreamLevelā but it seems the symptoms and fix works the same for that so maybe their behaviours are the same. This has taken me three days to figure out, trying this and that. It would have been good if this was mentioned in the Blueprint documentation.
How was this solved? can you go more in depth, show some blueprint code you were able to come up with that solves this? Iām getting same result as AGPStudios.
Hi! I donāt think showing my actual blueprint would help much as it is a bit particular to my case.
Basically I just set up a āreport backā system where the server set a checking variable that was replicated down to the Client/Remotes GameInstance (so its persistent) and then i have a little loop (sorry) that halts the process until it detects this variable is set which means that the Server is ready and coast is clear for Remote to continue loading the instance/stream.
How do you know when the level is loaded? Iāve found get streaming level, but I donāt know how to get the package name for an instanced level. It doesnt seem to match the name of the tile, what is the package name exactly? Iāve seen references of a direct path, like /Game/Maps/etcā¦ is that correct?
It might not work for your case but Iām setting a āMapIDā from BeginPlay of the Map that Iām streaming/instancing in. But on the GameInstance as I mentioned.
Pass the level information to the clients and have them create the same streaming level with the same name as the server (same function as 1, but on each client.)
I have confirmed that the Unique Instance Names are identical on server and client, and that the server is definitely loaded before the client, and yet my clients are still kicked!
Sorry to necro, I am playing around with this in UE5.3 and I cannot seem to get this to work without the client disconnecting. I tried the solution @jacksonnexhip posted, I tried preloading the level like @Rama said. Even using the āUse Client Side Level Streaming Volumesā in the persistent levelās world settings and using streaming volumes to stream in a sublevel, the outcome is exactly the same. The level gets displayed for a second, then the client resets the map and I see it disconnected in the output log.