Memory Streamer Usage Details
The Memory Streamer is special in that it is meant to record, play back, and resume gameplay during a single session. The live game is able to continue, invisibly and silently, while the player is watching a replay, so that the game can be resumed seamlessly the moment the replay ends. At load time, the engine collects levels into three groups: Static Levels, Dynamic Source Levels, and Dynamic Duplicated Levels. These groups determine how the level will interact with live gameplay and the replay system, as follows:
Levels added to this collection
Levels that are not the persistent level and are marked with the
Should be unaffected by gameplay, and will be shown during both live play and replays.
Dynamic Source Levels
The persistent level and any sublevels with the
IsStatic boolean variable set to false.
Affected by live gameplay. Hidden during replays, but with gameplay still running as normal.
Dynamic Duplicate Levels
Copies made from Dynamic Source Levels at load time. Do not exist on dedicated servers or in editor mode.
Hidden during live gameplay. Replays take place in these levels, then they are emptied out.
The "Is Static" setting can be found by activating the Levels view from the Window menu, and then clicking the Level Details button with your sublevel highlighted.From there, the "Is Static" option will be available in the Level Details window. This window will be empty for the persistent level, so make sure to select a sublevel.
These level collections are a part of the level-streaming process and are not specifically related to the Replay system.
With this system in mind, we can create one
DemoNetDriver for the Dynamic Source Levels, and another for the Dynamic Duplicate Levels. This enables us to record live gameplay in the Dynamic Source Levels and then play that data back in the Dynamic Duplicate Levels. By hiding the Dynamic Source Levels and showing the Dynamic Duplicated Levels during replay, the game can continue playing and receiving network updates unaffected by the replay. The third group, Static Levels, can be active and visible at any time; they should contain things like static world geometry or ambient background sounds, particles, and animations that are not affected by live gameplay, and therefore do not need to be involved in the replay process. When the replay is finished, the contents of the Dynamic Duplicate Levels will be destroyed will undergo garbage collection, and the Dynamic Source Levels will be made visible/audible again. Since the Dynamic Source Levels were never destroyed or suspended, only hidden, the game will have naturally progressed while the replay was being viewed, and can be shown immediately and without hitches. Additionally, this system enables increased efficiency by giving the developers the ability to mark levels as static in order to exclude them from replay recording and playback, saving both memory and time.