Streaming


Streaming - Basics


Streaming is a mechanism used to load and unload layers, along with objects that they contain. It's not automated in RED Engine, and therefore must be handled manually. Layers are not attached to any coordinates in the world, thus you, as the user, must define groups of layers that will be loaded.

Also, streaming operates on layer groups only, so you can't stream in single layers without making separate layer groups for them.

Last but not least – streaming is separate from isHidden flag on the layer groups. So if you'll stream in groups of layers and they have "isHidden" flag on, objects placed on those layers still won't appear in the game world.

A basic tool for defining those definitions is called world partitions.

World partitions - Basics


There is a type of object called world partitions, it can be created anywhere in the Asset Browser by right clicking and choosing world partitions object type. In this file you can define what streaming partitions you will have prepared for a certain world.

NOTE: It's advised to use each partition exclusively for a certain world.

After you have created the world partitions file, you should load a world on which you will want to use it. When world is loaded, you should open the world partitions file.

World partition editor is divided into four separate fields: a list of partitions to the left, a list of layer groups included in the selected partition, all layer groups existing in the world, and properties for selected partition.

A partition means a pre-defined set of layer groups – you can create a number of separate partitions and switch between them later on in the game. Only one partition may be active at a time. Loading a partition causes layer groups included in that certain partition to load, and those which are not included will be unloaded.

Keep in mind that partitions inherit from one another, if you create them under other partitions in the partitions tree. For example, if you will create "partition B" under "partition A", and then you'll load "partition B", all layers defined in "partition A" will be streamed as well. Thanks to this, you don't have to add, for example, terrain to each partition.

World partitions – Editing


  • To create a new partition, simply right click on one of the nodes on partitions list (a partition always must be inheriting from another, base partitions should inherit after root partition) and choose to create a new partition.

  • To add layers to an existing partition, simply select a partition you want to edit, and choose layer groups from the list of world layer groups by double clicking. To remove layer groups from existing partition, simply double click on a layer group on the selected partition layer groups list.

Each partition has its own properties, that you can edit in the properties tab. Those are:
  • name
  • environmentType
  • loadingScreenPath
  • locationType
  • hasWindows
  • soundAmbient
  • musicCue
  • reverb

Ways to stream world partitions


After you have created your world partitions file, first you must attach it to the world. You can do that by selecting world node on the world scene list, and then switching to properties tab. There is a field in which you can include your world partitions file from Asset Browser.

When partitions are added to the world, you can start using your pre-defined partitions for streaming (you still can edit them in world partitions editor, if you wish). There is a number of ways to do so:

  • Starting world partition – it's a field available in the world properties tab. The partition defined in this field will be loaded by default, when the world is loaded. If not changed, it will load root partition.

  • Streaming area triggers – it's a special class of trigger, that you can place on the world by right clicking and selecting them. After you add such a trigger, you may define what partition will be loaded on player entering or leaving the trigger.

NOTE: Keep in mind that triggers, as all other objects, are unloaded when a layer group containing them is unloaded. Thus, it's easy to unload streaming triggers by accident.

  • Quests editor – you can add a special quest block called change world partition. In this block you define which partition should be streamed. You may also choose to show a special loading screen when the partition is loaded.

Changing worlds


There is also an option to load another world during the game, from the level of quest editor. It can be done using change world quest block – you simply define in there which world to load from the Asset Browser.

NOTE: Keep in mind that quests are strictly attached to the game world layers, so when you change a world your active quests will be no longer active.
Also, there is no way to save signal in those quests if you want to return to them later. Only data that gets transferred to another world is: player stats, inventory and facts database.