Advertisement Jump to content
  • Advertisement
  • entries
    28
  • comments
    18
  • views
    5187

Unreal Engine 4: Level Streaming Demystified

HunterGaming

1106 views

So I have finally got some level streaming to work in the project I'm working on. The next blog might be progress on it. But for now I want to explain quickly how level streaming is designed to work and how to get it to work for streaming just a single level. I have a small level that is too small to be broken into smaller pieces but large enough to take few seconds to load it. Like a lot of things the official docs are good but doesn't help for situations like mine.

Level streaming is normally used to load and unload one level into another level. Making it easy to have large levels broken into pieces. You have just a small, whats referred to as a persistent level, to start and load other levels into and out of your persistent level as needed. So you set up a trigger so when the player walks through another part of the level is loaded. Is it a process that can be seen so you must take care to make sure the player can't see that level until its completely loaded.

You have the option to load the level asynchronously or not by checking Should Block on Load.

1.png.5b8cee68d747aa8d9a5e60fa5a3f91a1.png

In order to set up level streaming you must add the level you want to stream to a list of levels. The level that is currently open at this point will automatically be chosen as the persistent level.

2.png.13cae2641cb1bf17c42baafd0b074f52.png

The level that is currently loaded will automatically be selected as the persistent level. Once there you can click the Levels drop down menu to either create a new level, or load an already existing level, to add to the list. Levels added here will be the sub levels you want to load. For me right now its just one level called Downtown_L.

3.png.ced5811c1a7cc057ec3470698ebf308e.png

Now there is a lot of good tutorials and documentation available on the internet but they all explain it from a standpoint of having large levels broken into small levels and loading/unloading as needed. There is not much out there explaining from the standpoint of a single level that is too large to just load using OpenLevel because it takes too mush time to load and blocks the main thread until its done loading. Which I think is where a lot of one-man-band indie developers are coming from as being the only person working on a game limits,somewhat how large levels can be. Unless your willing to spend large amounts of time on it.

So how do you go about using this technology to load smaller single levels? Well what I did was create a completely empty level to use as the persistent level. So it loads super quickly. In begin play of that persistent level I show a loading screen. I should be able to eventually make the loading screen animated as level loading shouldn't be a blocking task now. After the loading screen is shown I immediately call LoadStreamLevel to load my single level into the empty level. Now it work. The empty level is loaded super quickly and shows the loading screen. Which currently is just text that says loading. But it stays there as the level is loaded and is removed once the level is finished loading. As its not blocking and I don't yet have a loading screen that blocks the whole screen, I can see the level being put together. It's kinda cool. I will be updating my loading screen next to make sure it blocks the whole screen and looks pretty to the player. Here is my begin play from the persistent level's level blueprint.

4.png.eb9ef8243e50b58139bc2ab3900022b6.png

5.png.4ead3fcee6d8f8bfd82de636d7f73d0e.png

6.png.9c253f933db2e4a09cbaa7ed8ffe438e.png



1 Comment


Recommended Comments

Little update I just found out. It wasn't spawning the player because I didn't set the game mode overrides for the persistent level. However the player character still doesn't seem to be placed at the player start. I still have to move it to there.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!