Handling level content streaming

In this recipe we are going to divide an existing scene into parts so that it can be streamed as required to unload parts that are no longer required, and ensure parts that are not yet required remain on standby. Streaming helps maximize performance by only loading areas the player can see. Moreover, streaming isn't only useful for performance optimization. In many storytelling scenarios, streaming can be used to selectively expose different features of a level based on player actions. This provides a nice way to generate a non-linear experience.

Handling level content streaming

Getting ready

Open the file Packt_06_Persistent_Start.UDK, which represents the shared content persistent across the boundary between two streamed levels. The scenes we're going to stream have already been divided up from the scene we used in the previous recipe. In your own scene, you'd have to work out which elements would be saved to which scene. There is an upper level and a lower level, and the persistent level includes the elements which bridge those. Essentially this scene will be like an airlock between independent spaces.

How to do it...

  1. For simplicity in this tutorial, the content is already divided up for you, since otherwise you would need to follow a long list of actor selection steps. As it is, this content is a mix of BSP and StaticMeshes.
  2. Press Ctrl + Shift + F to browse and click on the Levels tab.
  3. From the menu click Level to expand it, then choose Add to Existing Level.
  4. Browse for and highlight both these scenes: Packt_06_UpperLevel.UDK and Packt_06_LowerLevel.UDK. When they are importing, from the drop-down list, choose Kismet as the streaming method. This means we must set up a Kismet sequence to tell the content to load and unload. It can also be done by Distance, or it can be Always Loaded.
    How to do it...
  5. Right-click on the entry LowerLevel and choose Make Current. Any changes you make in UDK would then be saved out (like a Photoshop Smart Object) to the Packt_06_LowerLevel.UDK scene.
    How to do it...
  6. Build the scene [ How to do it... ] to look for duplicate items in the Map Check feedback that pops up after the build. There should be two copies of a type of StaticMesh beam in the floor and ceiling of the lower level.
  7. Delete one of the floor beams and one of the ceiling beams, then select the two that remain. Right-click on them and choose Level | Move to Selected Level, or press Ctrl +M, which will place these into Lower_Level, since that's where they belong. A good way to check this is to use the Eye icons [ How to do it... ] in the Levels dialog to toggle the visibility of level content.
    How to do it...
  8. In the Levels list, right-click on the entry Persistent Level and choose Make Current.
  9. You will also have two duplicate PointLights exposed during the Build All we did before. You can likewise deal with these in the Map Check feedback by selecting the extra ones and pressing Delete. Set the original two so they belong to the Persistent level by highlighting them, pressing Go To, then pressing Ctrl + M.
  10. The erroneous duplicate objects and lights were included here to show how such problems may be solved easily. Save what you have, then PIE. You will notice that only the persistent level content is visible.
  11. Press Esc, then go to Kismet [ How to do it... ]. Create a new Level Loaded event and hook this up to Load nub of a New Action | Level | Stream Levels.
  12. In the Stream Levels action's property Seq Act_Multi Level Streaming | Levels add a new entry [ How to do it... ] and in the Level Namechannel type Packt_06_LowerLevel, and the node should get a green tick.
    How to do it...
  13. In the scene, use the Edit | Find Actors tool to locate the actor Trigger_0. With this selected, in Kismet, right-click and choose New Event Using Trigger_0 | Touch. This trigger is by a toppling metal door, so you can also find it by going into the Sub-sequence Lift Attachments and looking for the trigger event firing off the Matinee UpperDoor.
  14. From the Trigger Touch event extend a wire to the Unload nub of the Stream Levels action. Then add another Stream Levels action, and hook the Touched nub up to its Load nub. For this second Stream Levels action, in its property Seq Act_Multi Level Streaming | Levels add a new entry and in the Level Name channel type Packt_06_UpperLevel, and the node should get a green tick.
  15. You can do a lot of back and forth interchanges between streaming level content. If you want to see the level streaming before or after from what we've set up, PIE then after you trigger the metal door open, go back where you started from to see what has been unloaded. In normal gameplay, the elevator wouldn't let us go back down to the unloaded part unless it was reloaded again. An example is provided in the map Packt_06_Persistent_DEMO.UDK.
..................Content has been hidden....................

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