# Dynamic level streaming with multiplayer support

**URL:** <https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [November 30, 2016, 1:56pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517 "2016-11-30T13:56:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [November 30, 2016, 1:56pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/1 "2016-11-30T13:56:06Z")

</div>

In the past, I had issues in the past trying to [dynamically streaming levels that work with multiplayer](https://answers.unrealengine.com/questions/246006/dynamic-level-streaming-in-c-with-multiplayer-supp.html).

Recently I found a solution, thought I’d share.

I created a simple Blueprintable struct to hold the info from a [Load Level Instance](https://forums.unrealengine.com/showthread.php?108644-Load-Level-Instance-Create-Multiple-Transformed-Instances-of-the-Same-Level-not-in-levels-list%21) - which includes the unique name of the instance - that can be replicated to clients.  
Once replicated to a client, I created a function that takes the info from the struct, create a level streaming object, add it the clients StreamingLevels and makes it visible etc.

End result - loading a level at runtime on the server and having it appear on a client.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/5/d65218c931c6e1fb4231f336ba8440197347c9b0.jpeg) ](https://i.imgur.com/R7wPt0c.jpg)

I’ve already created a pull request for the [Victory Plugin](https://forums.unrealengine.com/showthread.php?3851-(39)-Rama-s-Extra-Blueprint-Nodes-for-You-as-a-Plugin-No-C-Required!) and annoyed Rama about it, so hopefully it’ll be in there soon.

We’re currently using it in Ground Branch to stream in a single level and it seems to work fine, both in packaged and non-packaged builds.

I hoping a few people will be interested enough to try it out and either break it or confirm it works.

If this does interest you, post a comment letting me know.  
I can either post the C++ directly here (its pretty simple) and/or annoy Rama about it more 🙂

---

<div class="post-metadata">

**Author:** ![draquod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@draquod](https://forums.unrealengine.com/u/draquod)\
**Post date:** [February 13, 2017, 11:24am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/3 "2017-02-13T11:24:39Z")

</div>

Hello Kris,

I would be interested in the code as I have managed to load a level but the actors from the server map are not replicated, the client loads a new instance with new actors.

Thank you.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [February 13, 2017, 12:05pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/4 "2017-02-13T12:05:36Z")

</div>

G’day,

I submitted it quite some time ago and it should already be part of [Rama’s Blueprint function library](https://forums.unrealengine.com/showthread.php?3851-(39)-Rama-s-Extra-Blueprint-Nodes-for-You-as-a-Plugin-No-C-Required!).

_Should_ 🙂

---

<div class="post-metadata">

**Author:** ![draquod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@draquod](https://forums.unrealengine.com/u/draquod)\
**Post date:** [March 31, 2017, 4:17pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/6 "2017-03-31T16:17:37Z")

</div>

Yep, I later found that out, thank you.

I have also made a pull request to be able to unload level instances replicated using this method on the client ( altought I had to add a little bit of extra code to handle that in Play In Editor as that appends some additional information to the level instance packageName based on the client id )

---

<div class="post-metadata">

**Author:** ![Celldelning](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Celldelning](https://forums.unrealengine.com/u/Celldelning)\
**Post date:** [May 10, 2018, 9:59am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/7 "2018-05-10T09:59:04Z")

</div>

Hi Kris!

Thank you for sharing your solution.

This really helps me out with my project but I have actually got a crash problem :S  
Everything seems to crash when I try to have more than 2 clients.

Have you or any other person any idea what may cause this problem and how to solve it?

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 10, 2018, 10:22pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/8 "2018-05-10T22:22:20Z")

</div>

Sorry, nothing comes to mind ☹

---

<div class="post-metadata">

**Author:** ![Celldelning](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Celldelning](https://forums.unrealengine.com/u/Celldelning)\
**Post date:** [May 11, 2018, 1:59am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/9 "2018-05-11T01:59:34Z")

</div>

Thank for your answer man!

I am Sorry, it actually when I have 2 clients or more that it crashes.  
Created a dummy project and implemented the same solution as you have in your example.

It works with either:  
Server + Client  
or  
Dedicated server with one client

So it seems that it crashes when I try to run the game with more than one client. :S

---

<div class="post-metadata">

**Author:** ![Harcarik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harcarik](https://forums.unrealengine.com/u/Harcarik)\
**Post date:** [May 11, 2018, 2:25pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/10 "2018-05-11T14:25:55Z")

</div>

@Kris , i am little bit lost, even when using your screenshot as guide. Could you please tell me how did you get from setting variable ‘LevelStreamInstanceInfo’ to event ‘Load on client’?  
My guess is that after setting the instance info variable, something triggers ‘LoadOnClient’ event. That event first checks if the variable is not empty and adds level to streaming levels.  
But what then? How do i get the level to load on client? Could you please elaborate on that? In any case, thanks for the nodes!

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 12, 2018, 8:56am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/11 "2018-05-12T08:56:34Z")

</div>

From what I recall, I had BeginPlay() calling either LoadOnServer() or LoadOnClient() depending on whether it was the server or client.  
It would have been better to set the LevelStreamInstanceInfo to “rep notify” instead, which would guarantee the struct had been replicated before trying to access it.  
That is what I do now, but with a C++ version of this same class.

---

<div class="post-metadata">

**Author:** ![Harcarik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harcarik](https://forums.unrealengine.com/u/Harcarik)\
**Post date:** [May 12, 2018, 6:19pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/12 "2018-05-12T18:19:21Z")

</div>

Thank you! With your help I made it work. I still have few problems with it tho.  
Same as @Celldelning was reporting, i cannot have more than 2 players. Be it server and client or 2 clients.  
And then, i have no idea how to load more levels into the persistent level. If i add more ‘load level instance’ nodes, it loads only last one. If possible, please advice.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 14, 2018, 11:47pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/13 "2018-05-14T23:47:43Z")

</div>

PIE multiplayer?

---

<div class="post-metadata">

**Author:** ![Harcarik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harcarik](https://forums.unrealengine.com/u/Harcarik)\
**Post date:** [May 15, 2018, 7:29am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/14 "2018-05-15T07:29:17Z")

</div>

Or multilayer in general. I am trying to create system where one Persistent map is filled with smaller level instances by random generator. In singleplayer game it works fine. In multiplayer, it seems impossible. Screenshot i posted above works with only instance added to the persistent map and only two players.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 16, 2018, 4:51am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/15 "2018-05-16T04:51:00Z")

</div>

Wondering if in my doing this in C++ fixed some unforeseen bug and/or something changed in the underlying engine since I created the Blueprint node.

As mentioned, it definitely works with multiple clients my end.

_ugh_

Welcome to game development! 🙂

This is one more reason for me to go over the old code I submitted to Rama’s Victory Plugin.

---

<div class="post-metadata">

**Author:** ![Harcarik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harcarik](https://forums.unrealengine.com/u/Harcarik)\
**Post date:** [May 17, 2018, 6:41am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/16 "2018-05-17T06:41:02Z")

</div>

I would really appreciate if you could please make it work. I am really helpless without this feature.

---

<div class="post-metadata">

**Author:** ![ItsMeButters](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ItsMeButters](https://forums.unrealengine.com/u/ItsMeButters)\
**Post date:** [July 10, 2018, 9:41pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/17 "2018-07-10T21:41:50Z")

</div>

So the reason it’s only streaming in the last segment is because replication doesn’t start until after the server has finished loading (I think). So your replication is only getting called once, after the last tile has loaded. I worked around this by making a separate Level Instance Info Array, and storing each tiles individual info into it as the server streamed them in. Then by the ttime the replication call happens, that array is full of all the level streaming infos and you can just use a for loop to parse through and load each one.

---

<div class="post-metadata">

**Author:** ![Tolc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tolc](https://forums.unrealengine.com/u/Tolc)\
**Post date:** [January 6, 2019, 6:23pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/18 "2019-01-06T18:23:39Z")

</div>

**Found the solution to the multiplayer crash in editor with 2 players or more!!!**

@Kris code works well, and as a matter of fact has always been working if you tried it with a real built server, outside the editor.

We are all \*just \*testing it wrong.  
[TABLE=“border: 0, cellpadding: 1, width: 75%”]

When you want to try your game with multiplayer in the editor,  
basically all you do is set the correct options in the dropdown next to the huge ‘Play’ button:

- Number of players

- Dedicated server or not

**But it turns out that the default behavior of the engine is to spawn multiple player windows in the same instance of UE4.**  
This means that your players are kinda faked and that they all share the same World, for example.

Doing this loads much faster indeed, but it can cause lots and lots of various issues (as this precise one), and this is absolutely not what you want when testing your game. You want to be as close as possible to what happens on a real server and real clients.

Here is what you have to do to fix that weird behavior:

**1 -** Click on **Advanced Settings**

 ![UE4EditorWin64DebugGame_20190106_185415.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/c/8c9a38b5b0b88d9dc5b6078faea530fb50d70a02.jpeg)

**2 -** Locate **Multiplayer Options** and uncheck \*\*Use single process

 ![UE4EditorWin64DebugGame_20190106_185837.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/7/f783bcdf3fb99baa47c82af1dead65c6f52ee03c.jpeg)\*\*

3 - New options will appear and some will disappear. Set the **Editor Multiplayer Mode** to **Play As Client**.

 ![UE4EditorWin64DebugGame_20190106_190257.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/6/6683a65c90ec2f08ed8880499e036d1603696a99.jpeg)

4 - You can also obviously set the other options to whatever suits your needs - and/or your machine performances.

Now when you hit play, you have a real server instance, and players each in their respective engine instance as well!

Here is a screenshot of a level that has been loaded with level streaming in dedicated mode with @Kris code and 2 players:

 ![UE4EditorWin64DebugGame_20190106_191053.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/5/b50f786cddd4bf8220e3b210de03454a17d3da52.jpeg)

Hope it helps 😉

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [January 6, 2019, 7:54pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/19 "2019-01-06T19:54:22Z")

</div>

That’ll explain why it worked for me then.  
I tend to use batch file to start a dedicated server etc outside of the editor.  
I leave in-editor testing for quick basic things.

---

<div class="post-metadata">

**Author:** ![Tolc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tolc](https://forums.unrealengine.com/u/Tolc)\
**Post date:** [January 10, 2019, 3:18am UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/20 "2019-01-10T03:18:18Z")

</div>

I may have been a bit too optimistic…  
It sure does not crash anymore with 2 players or more, but replication does not work for Actors in levels that have been streamed.

I mean, replication still works for PlayerControllers, I can see other players move, etc. Their variables are replicated, and RPCs from and to a PlayerController work as well.

But for Actors in levels that have been dynamically streamed, it just doesn’t. Everything is visually there and seems in order, but…no. ☹  
**It’s like the server does not know it has to replicate things to clients.**

When I play those levels with the same multiplayer settings, everything is just fine, so the issue is definitely with dynamic level streaming… or maybe the way I am using it…  
Precisely, I’m creating levels instances on the server using **ULevelStreamingDynamic::LoadLevelInstance** in my **GameMode::BeginPlay** , and I stream them on the client when the client connects, using your code.

@Kris, do/did you have this problem?  
Or maybe all the replication your game needed was in the PlayerController? (seems unprobable but it may be possible depending on what kind of game you’re using dynamic level streaming for, I don’t know…)

I tried\*\* A LOT\*\* of things, so at this point I’m willing to try any new idea. 😛

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [January 10, 2019, 7:40pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/21 "2019-01-10T19:40:16Z")

</div>

Sounds awfully familiar (replication issues).

Looking at code, I see reference to a hack-fix:

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-24280)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

---

<div class="post-metadata">

**Author:** ![Tolc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tolc](https://forums.unrealengine.com/u/Tolc)\
**Post date:** [January 12, 2019, 2:32pm UTC](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/22 "2019-01-12T14:32:38Z")

</div>

Thanks for this, it will be helpful.

But dammit… Correct me if I’m wrong…that means I’ll have to use a custom engine to have this working properly? ☹

[Next page](https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517.md?page=2)
