Replicated Properties

In Morpheus as in Unreal, the basic unit of replication is the property. Properties are marked for replication the same way as in Unreal, but Morpheus can only replicate properties belonging to classes based on AMorpheusActor and AMorpheusActorComponent.

This page will detail the concepts introduced with replicated Morpheus properties, before demonstrating how to implement them in the How to define properties section below.

Replication semantics

Property replication in Morpheus follows the same semantics as Unreal.

Property replication is reliable. This means that the property of the client version of the Actor will eventually reflect the value on the authority, but the client will not necessarily receive notification of every individual change that happens to a property at the authority. For example, if an integer property rapidly changes its value from 100 to 200, and then to 300, the client will eventually receive an update with the value of 300, but there is no guarantee that the client will know about the change to 200.

This applies to all property network levels (i.e. Foreground, Midground and Background).

Features

Network level

In Morpheus, every replicated property belongs to one of three network levels (Foreground, Midground or Background). See Network Levels for details.

Client authority

In standard Unreal networking, only the server can update replicated properties. If a client wants to change a replicated property, it must send an RPC to the server instructing it to do so.

In Morpheus, however, you can define client authoritative properties. This means that the client which is authoritative over the entity can directly change the replicated property, and the new value will be sent to the server and other clients.

This allows you to avoid the server becoming the bottleneck for certain systems where it is appropriate. Properties belonging to any network level can be marked as client authoritative.

The server still receives a 4Hz view of all client authoritative properties, which it can use to validate that the client is behaving appropriately. It would be up to the user to perform validation of client authoritative properties on the server, and one potential response to a client behaving inappropriately is kicking the client.

NOTE: For Client Authoritative properties to work, the actor must be spawned with Client Authority. For information on how to do this, see Spawning. NOTE: Once a property is defined as client authoritative, the server no longer has authority over the property and modifications made by the server will not be replicated.

RepNotify

Morpheus supports RepNotify functions with the same behaviour as native Unreal. That is, when a property update is received and if the received value is different to the local value, then the RepNotify function will be called. If the received value is equal to the local value, then the function is not called.

Note that RepNotify execution is ordered across sub-objects; an Actor's RepNotify function will always be executed before those of its components.

Owner Only

You can mark a foreground server-authoritative property as Owner only, which means it will only be replicated to the authoritative client.

Update Fast in Midground

You can mark a background property as Update Fast in Midground. This is a performance trade-off. Normally, a background property will be updated at 2Hz, regardless of whether the property's owning actor is in background, midground or foreground. If you enable this feature, then when the property's actor is in midground or foreground, the client will receive updates at 10Hz (the same rate as for a midground or foreground property).

In other words, you get the best of both worlds: the property is available for every actor in the scene, yet is highly responsive for higher-priority actors. The downside is increased server load: it's equivalent to adding another midground property to your actor.

Supported types

Foreground

Foreground properties can use the same types as standard Unreal networking, with one exception. Object references must be references to:

Midground and background

Midground and background properties are more limited. They can only use the following types:

  • Bools

  • Integers

  • References to Morpheus actors and Morpheus actor components

  • Structs comprising any of the above

    • They can be nested

  • Floats & doubles

Floats and doubles are a special case: Morpheus compresses them lossily on replication. You need to specify your required level of precision in the property's Details panel. (For instance, a property with a Precision When Replicated of 0.01 will only replicate to an accuracy of two decimal places.) This requirement means that non-foreground structs can't contain floats or doubles.

How to define properties

Properties are marked for replication through the Details panel in the Blueprint Editor. This is also how you turn on all of the above features.

By default, properties aren't replicated. Mark them for replication using the Replication dropdown. The default replicated property is foreground and server authoritative.

Note that:

  • Morpheus replication settings are only available within classes based on AMorpheusActor and AMorpheusActorComponent.

  • If the Network Level option only shows Foreground, the property you are attempting to replicate is only compatible with the Foreground network level (see Supported types above).

  • Create a RepNotify function for a property by setting the Replication drop-down to RepNotify.

Last updated