Streaming levels

As levels get more and more complex, they can sometimes get quite unwieldy. One of the tools that we have as designers is the ability to break our levels apart and load them in at runtime. This is also incredibly useful for working in teams, where one person can work on one part of the game and bring it all together later.

We will look at the easiest way to load in a level instantly, which is to have the level always being loaded.

Getting ready

This recipe assumes you have two levels you'd like to have loaded at the same time. I will be using the levels created in the Placing trees and rocks using the Foliage tool recipe in this chapter and the Meshing an example map recipe from Chapter 3, Creating Quality Interior Environments.

How to do it…

Let's first export one of these rooms so that we can give them to our artist to work with:

  1. Open up the level that will be considered your base level. In our case, I will be using the map that contains our completed landscape.
    How to do it…
  2. Under Window, select Levels to open up the Levels window.
  3. From Levels, click and select Add Existing….
    How to do it…
  4. From here, you'll be brought to the Open Level dialog box. From there, select the map you want to be brought into the world. I selected the MeshingAn ExampleMap level. After you have the level selected, press the Open button.
    How to do it…
  5. Now if you planned ahead, your house and terrain will fit together nicely.
    How to do it…

    Final view of the house and the terrain

    If this is not the case, go to the Levels window and right-click on one of the levels and select Select Actors. Then, move the level to fit where you want it to be placed. Of course, this assumes that you have some flat terrain somewhere. If not, use the Flatten tool on the Foliage tab to flatten the area to make it easier for people to see.

  6. Of course, it seems like we are done now, but if we play the game, we won't be able to find the house. There's actually a really good reason for this; the level isn't actually loaded.
    How to do it…
  7. To fix this, from the Levels window, right-click on your house level and go to Change Streaming Method | Always Loaded.
    How to do it…

    Note

    If for some reason the method is grayed out, check to make sure your level isn't locked. If it is, click on the lock on the right-hand side to enable changes on the level. This is also a good tool to use if you want to make sure that you're only modifying one level at a time.

  8. Now let's build our lighting again and run the project!
    How to do it…

Now, we can see our levels loaded together!

Note

For those interested in having levels load dynamically over time rather than all at once, you can use blueprints to have levels stream in and out to create what seems like a seamless world. To see how to do this, refer to https://wiki.unrealengine.com/Blueprint_Manual_Level_Streaming.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.96.5