Pausing

In Strix, replication of an Actor is automatic. When you are in a room, every time you create (spawn) an Actor that has Strix Replicator component, its replicas are automatically created on all other client in the room. The same is true for such Actors created on other clients; they cause their replicas to be created on your client. When an original Actor is destroyed, its replicas are destroyed, too. Behind the scenes, network objects, objects maintained by a room server to keep track of all such Actors, are also created and deleted appropriately. A Strix’s internal client-side component called network object manager takes care of them.

The automatic replication usually works just fine, but there are cases that you may want to disable this automatic behavior temporarily.

Functions

The Strix’s replication functionality can be paused and unpaused using the following three Blueprint functions.

Also, Strix functions to join a room, including those to create a room and join it, have an argument called Pause Network Objects. If you set it True, it pauses the replication immediately after joining a room before any other actions take place, even before the success callback of the join function is executed.

Pausing

The function Pause Network Object Manager pauses replication. New network objects are created in the paused state, and do not spawn replica Actors.

Unpausing

The function Unpause Network Object Manager unpauses replication. Network objects in the paused state create their replica actors. It also recreates the Actors for any replicas that had their Actors destroyed after pausing.

Checking State

The function Is Network Object Manager Paused returns true if the network object manager is paused.

Note

  • Pausing doesn’t stop new Actors from replicating to other clients. It just prevents the actual spawn of those replica Actors. Once unpaused, the new replicas will be created.

  • Pausing is only related to replication of Strix network objects and does not affect other game logic in any way. Blueprint functions work as always while the network object manager is paused.

  • All the three functions take a channel ID as an argument. It means that the pausing takes effect for that channel. Pausing on a channel doesn’t pause Actor replication on another channel.

Note

This functionality is still experimental. Only use it if you are properly cleaning up Actors. The main use cases are shown below.

Use cases

Switching level

A typical use case of pausing is switching to a new level in a middle of an in-game.

The actual timing of the level transition may vary on clients even if your game application tries to make it happen at the same time. The ordinary behavior of Strix Replicator is to keep synchronizing the spawning and destroying of Actors all the time even in the middle of level switching process. When a client starts replicating its Actors on the new level, another client may still be on the previous level, possibly spawning the replicas for the new level from a faster client on the previous level, and those replicas are destroyed by the Unreal Engine when the slower client executes the Open Level function.

To prevent it, you can pause the replication on all clients before any client starts switching and unpause it after all the clients complete the switching.

See How to Change Scenes for details.

Joining an in-game room

Joining a room for an in-game level may need pausing, too.

Once a client joins a room, the network object manager on the client starts working immediately. That may cause the network object manager to start spawning replicas from other clients before you finish necessary setup after joining a room. It is true especially if you are joining in the middle of an ongoing multiplayer game.

Calling Unpause Network Object Manager in the success callback to the function such as Join Node Room can be too late, because there may be some delay between the actual joining and the execution of the success callback, and the replication may start during the delay.

To avoid such an issue, you can call Join Node Room function with its Pause Network Objects argument set to True. If you do so, you should call Unpause Network Object Manager after finishing any initialization.