Replication

Games usually need players and objects to be replicated across clients, and players need to be able to see other players and objects to interact with them. It is also necessary to make sure that the properties of these Actors are synchronized as well.

In the Strix Unreal SDK, replication is handled by the Replicator Component. This Component registers the class of the Actor that it is added to with Strix, and Strix spawns a replica of this Actor in the other players’ game worlds.

It is strongly recommended that the level of each player be the same if Actors will be replicated across them. Replicated Actors are real objects in a player’s world, and therefore can interact with any Actors within. Strix is made of non-dedicated servers, so take care to avoid desynchronization issues.

The Strix Replicator Component

The Strix Replicator Component is the base replication Component and is required by all other Strix components. It is necessary to place this on any Actor that you wish to use any of the other four components on. This is because the Strix Replicator is the Component responsible for assigning Type Id, a property used by Strix to recognize which type of Actor it’s currently dealing with.

The Strix Replicator registers an Actor class with Strix. When a player joins a room, the Replicator instantiates a replicated Actor of that class on the other clients at world position 0,0,0. Any existing Actors with a Replicator Component on other clients are also replicated in the new player’s world.

Options

The Strix Replicator can be added to any Actor other than static world objects. The Strix Replicator has the following options:

Ticks Per Second

int

The number of updates to the Actor’s properties every second.

Instantiable By

Anyone or Room Owner

Determines who instantiates replicas of this Actor on other clients.
When it is set to Anyone, all players in the room will instantiate a new replica of this Actor on all other clients.
When it is set to Room Owner, only the Room Owner will instantiate the replica, so there will be no more than one replica of this Actor on every other client. This is useful for objects like pick-ups.

Connection Closed Behaviour

Delete or Change Ownership

Determines the behavior when a connection is lost.
The default is Delete, which will destroy the Actor when a connection is lost.
Change ownership will instead select a new owner for the object and change its ownership to that owner. Use this to keep Actors alive until the room empties.

Should Receive Destroy Events

bool

Determines if this Actor will be destroyed when its original is destroyed.
The default is true.
If false, the Actor will ignore deleted messages from the server.
This means that even if the original Actor is destroyed, its replicas will remain on other clients. This may be required for smooth removal of Actors from levels when players unexpectedly disconnect.

Auto Register Properties

bool

The default is true.
If true, the Replicator will sync all the Blueprint variables of this Actor it can (all primitive types and structs), whose replication condition is set to Replicated.

Note

Replication for non-Blueprint Actors is not supported.

Replicator Events

See Synchronization Events