Search public documentation:
- Using Level Streaming
- The Persistent Level
- Scripted Streaming via Kismet
- Distance-based Streaming
- Working with the Streamed Levels
- Streaming Volumes
By following the directions in this document, Unreal Engine 3 users should be able to successfully set up the realtime streaming of multiple levels together to create the illusion of one large, seamless world. For information about volume-based level streaming, see the doc on Level Streaming Volumes.
The first step towards getting your levels to blend together seamlessly is creating the persistent level. This can be thought of as a master level that is primarily used to govern which levels will be streamed in and out. Creating a persistent level and adding streaming levels to it can be done in just a few simple steps:
- Create a new map, add a small cube of geometry out of sight somewhere (this simply validates it as a level as far as the engine is concerned, and will likely be a step that is done away with eventually)
- Place a playerstart wherever you would like the player to begin. Note that in the persistent level this playerstart will likely be floating in space, but once you have streamed a level in, it should be moved to wherever you want the player to begin in the first streamed level. We will be launching the persistent level when it's time to play the game, but the player will actually be moving through the geometry of one of your streamed levels, not the persistent level.
- Save your map, giving it a name denoting it as the persistent level for your own organizational purposes. Headquarters_P, for example.
- Open the generic browser, and click on the "Level" tab. This is where you must list every level that you wish to stream in. If Headquarters consists of three maps, all three should be added here. Do so by selecting Level->New From File from the Level pull-down menu. The order in which you add the streaming levels is not important, but future versions of UnrealEd? will allow you to re-order the levels to keep things organized. You should end up with something like what is in the picture below.
- Note that you will be given the option to stream your levels in by distance or by kismet:
- Distance streaming loads and unloads a level based on the player's distance from the level's origin.
- Kismet streaming allows the designer to load and unload the level at will via kismet scripting, and thus is the most common choice here.
- Create a new map in UnrealEd?
- Add a piece of simple BSP geometry, such as a cube
- Add a playerstart
- Add the levels you would like to stream in the Level Browser.
- Save and name the map
Once you have created your persistent level as detailed above, you are ready to start choosing which streaming levels to load into your game. There are two parts to this; streaming (loading) the level and making the level visible. To stream your levels via Kismet, simply follow these steps:
- Open Kismet
- Place a level startup (New Event -> Level Loaded)
- Place as many Stream Level actions as you have levels (New Action -> Level -> Stream Level)
- Add the name of each of your levels to the Stream Level actions by clicking on them and entering the level name where it says LevelName.
- Connect the level loaded to each of the Load inputs on the Stream Level actions.
- Open Kismet
- Add a Level Loaded action and a StreamLevel action, connect the Level Loaded to the Load input
- Left-click on Stream Level and add the name of the level you would like to stream to the "LevelName" field and check the bMakeVisibleAfterLoad flag.
- Save your map and launch the game.
If you have chosen to stream your level in based on its distance from the player, there are some extra steps to take. First, make sure your persistent level is selected in the generic browser, and then expand the WorldInfo category on the far right-hand side. Right-click on the WorldInfo_# that you should now see and select "Edit Properties". Open the WorldInfo property in the property window and then open the StreamingLevels property. You should see each of the streaming levels listed here. You will now be able to set at what distance from the player the level will stream in at in the MaxDistance field. Think of this as a sphere that is centered at 0,0,0 in that level's world space by default. When the player enters this sphere, the level will stream in and when he leaves the sphere, the level will be unloaded. The location of this sphere can be changed, and most likely will have to be, since you'll in most cases want this sphere to completely surround the level you are streaming in, so that it is loaded when you are near the level, and unloaded when you leave the levels immediate area. We are planning on adding ways of visualizing where this sphere exists, but this has not yet been implemented. This method of streaming can be useful for situations where you want to load and unload a level numerous times, based on player distance from the level. Note that there may be a noticeable hitch as the level loads, if it is a large map, as the level is actually being streamed in and out, not being hidden and unhidden. Example 4: Setting up distance-based streaming
- Open the Generic Browser
- Click the Level tab
- Select Level->New From File from the Generic Browser file menu and select the level you would like to stream in
- Choose "Distance" streaming
- Making sure "Persistent Level" is selected, expand the WorldInfo property on the right-hand side. Right-click on the WorldInfo_# and select "Edit Properties"
- In the property menu that should now be open, expand WorldInfo and then StreamingLevels.
- Enter the distance from the player in game units at which you would like the level to be streamed into the world, and change the origin to the location in world space you would like that distance to be measured from.
Level Browser (changelist #206324).
- Select a bunch of actors in the world.
- Select New Level from Selected Actors from the Level Browser’s Level.
- A new streaming level will be created on disk and added to the world, and the selected actors will then be moved to that new level.
For information about volume-based level streaming, see the Level Streaming Volumes page.
That concludes our overview of how to dynamically stream levels in and out of your game world. Since many aspects of this feature are new and constantly being updated, expect this document to be updated regularly as new features and simplifications come online.