The header files within the ValueSyncs
folder, along with IPropertySyncInterface.h
, form a structured system for synchronizing property values between Unreal Engine and the Cavrnus platform. These are the primary methods for synchronizing properties with the Journal to create a collaborative virtual experience.
Key Points:
This structure allows for flexible and type-safe synchronization of various property types between Unreal Engine and Cavrnus.
The
UCavrnusValueSyncBase
class handles the common synchronization logic, while the derived classes provide specialized handling for their respective data types.The system is designed to be extensible, allowing for the addition of new property types as needed.
General Workflow (How Syncs Work):
Attachment: A
UCavrnusValueSyncBase
-derived component is attached to an Unreal Engine actor that owns the property to be synchronized.Property Identification: The
PropertyName
property is set to the name of the property within the actor.Polling and Updates: The
UCavrnusValueSyncBase
component periodically polls the property value. If it detects a change andSendChanges
is true, it sends an update to the Cavrnus platform.Receiving Updates: The Cavrnus platform can send property updates back to Unreal Engine. The
UCavrnusValueSyncBase
component receives these updates and applies them to the corresponding property on the actor.
Blueprint Integration:
Each property-specific class provides Blueprint-callable functions (e.g.,
GetBoolean
,SetBoolean
) to get and set the property value, making it easy to integrate with Unreal Engine's visual scripting system.
Core Components:
IPropertySyncInterface
:This interface defines the contract for property synchronization, requiring implementing classes to provide methods for getting and setting property values (
GetPropertyValue
andSetPropertyValue
).
UCavrnusValueSyncBase
:This abstract class inherits from
USceneComponent
(allowing it to be attached to Unreal Engine actors) and implements theIPropertySyncInterface
.It provides a foundation for synchronizing properties, including:
Polling for property changes.
Sending updates to the Cavrnus platform.
Handling space connections.
Key properties include
PropertyName
(the name of the property to sync) andSendChanges
(whether to send updates).
Property-Specific Classes:
The folder contains several classes derived from
UCavrnusValueSyncBase
, each specializing in a specific property type:UCavrnusValueSyncBoolean
: Synchronizes boolean values.UCavrnusValueSyncFloat
: Synchronizes float values.UCavrnusValueSyncString
: Synchronizes string values (FString).UCavrnusValueSyncVector
: Synchronizes vector values (FVector).UCavrnusValueSyncTransform
: Synchronizes transform values (FTransform).UCavrnusValueSyncColor
: Synchronizes color values (FLinearColor).