Cavrnus Unreal API - LivePropertyUpdates
The header files in the LivePropertyUpdates
folder define a set of classes designed to handle real-time updates of different property types within the Cavrnus collaborative environment. These classes share a common base class, UCavrnusLivePropertyUpdate
, and provide specialized functionality for specific data types.
Key Points:
The
UCavrnusLivePropertyUpdate
class hierarchy provides a flexible and extensible way to handle real-time updates of various property types.These classes and functions handle synchronization of property values between different users and the Cavrnus server.
The use of BlueprintCallable functions makes these classes easily accessible and usable within Unreal Engine's visual scripting system.
General Workflow (How Transients Work):
The separation of temporary and final updates allows for smooth user interactions while ensuring data consistency.
Initialization: An instance of the appropriate derived class is created and initialized with the property's details.
Temporary Updates: As the property value changes,
UpdateWithNewData
is called to send temporary updates to the server. These updates might not be immediately reflected in the collaborative space for other users.Finalization: When the changes are confirmed,
Finalize
orFinalizeCurrentValue
is called to make the updates permanent on the server. This triggers the synchronization of the property value across all connected users.
Base Class (BUCavrnusLivePropertyUpdate
):
Purpose: This abstract class serves as the foundation for all live property update classes. It provides essential functions for managing the update process, such as:
Cancel()
: Cancels any ongoing property updates.GetLastUpdatedTimeSeconds()
: Retrieves the time elapsed since the last update.
Key Members:
livePropertyUpdate
: A pointer to the underlying implementation of the property update (likely in the Cavrnus backend).
Derived Classes (Specific Property Types):
UCavrnusLiveBoolPropertyUpdate
: Handles live updates of boolean properties (true/false values).UCavrnusLiveFloatPropertyUpdate
: Handles live updates of float properties.UCavrnusLiveStringPropertyUpdate
: Handles live updates of string properties.UCavrnusLiveVectorPropertyUpdate
: Handles live updates of vector properties (e.g., 3D positions).UCavrnusLiveTransformPropertyUpdate
: Handles live updates of transform properties (position, rotation, scale).UCavrnusLiveColorPropertyUpdate
: Handles live updates of color properties (e.g., RGB values).
Common Functionality:
Each derived class typically provides the following functions:
Initialize(...)
: Sets up the property update with the necessary information (property ID, initial value, etc.).UpdateWithNewData(...)
: Sends a temporary update with a new property value to the server.Finalize(...)
: Finalizes the update, making the changes permanent on the server.FinalizeCurrentValue()
: Finalizes the update using the most recently sent temporary value.