Containers for Room Properties¶
Strix provides many room properties as described in Room Properties, and you can also define your own custom properties to fulfil your game’s requirements. These room properties are packed in a container object for a room when handling them in your Blueprint scripts (or C++ codes).
Strix Unreal SDK provides several types of containers for room properties.
Strix Property Map struct¶
Strix Property Map struct is the most generic container to store room properties (and other properties such as room member properties) in Strix Unreal SDK. It is an object similar to UE Map container, but its keys are always strings (String structs) representing names of properties, and its values represent the corresponding property values. Unlike UE Map, the data types for values are not uniform; a value is one of several data types that Strix properties can be.
Strix Property Map struct can store property values of the following data types:
Byte
Boolean
Integer
Float
String
Note
There is no standard room properties of type Byte, but you can create custom Byte properties.
Strix Property Map struct is most often used to tell desired property values to SDK, e.g., to specify a set of initial room property values when creating a new room or to specify new values when updating room properties by SetRoom function. Strix Unreal SDK provides Set <type> Property functions for the supported data types to set a property value in Strix Property Map struct.
In general, you first make an (empty) Strix Property Map struct and set required property values, then you pass it to an appropriate Strix function.
Note
When you use a Strix Property Map struct for this purpose, you put both standard properties and custom properties in a single map as shown above. Standard properties are specified by their names (that are different from member names in Strix Room struct; see below) and their values should be in their data types as defined by Strix Unreal SDK (see Room Properties). Custom properties have their names and data types defined by you.
Another use of Strix Property Map is as a storage for custom properties in structs such as Strix Room (see below).
Strix Room and Strix NodeRoom structs¶
Strix Room struct is a dedicated container for room properties. It has a set of member variables that correspond to standard room properties, including customizable ones, so it is straightforward to use it. Please note that the names of member variables as seen on Blueprint scripts are different from the property names. For example, the name of the member variable for memberCount property is Member Count. (See Room Properties for the full list.)
Strix Room struct is used by the SDK to expose a set of room properties of a room on a room server to Blueprint scripts, so all its members are read-only.
Note
A Blueprint node Make StrixRoom is provided by the Blueprint graph editor, but it is not useful in general, because you can’t change its property values from their default values. Please don’t use Make StrixRoom node in your Blueprint scripts.
Using C++ codes, you can modify property values in Strix Room struct (or struct FStrixRoom in C++ terminology), but it is not recommended to do so. The change is only kept local, and there is no easy way to advertise the changed values to the server or other clients.
The Strix Room struct has a member variable Properties, which is a Strix Property Map to store custom properties. (standard properties are not included in Properties.)
Strix Unreal SDK provides Try Get <type> Property functions to retrieve custom property values from the map. The Value pin gives the retrieved property value.
Note
The node for Try Get <type> Property has an output pin called Result. It is a Boolean value to indicate whether the requested property value is retrieved successfully from the Strix Property Map struct supplied to Strix Structure pin.
If no clients (including myself) have defined a particular custom property for a room, the corresponding Strix Property Map struct doesn’t include it. The Result pin gives False if you try to retrieve its value.
Also, if the property was set previously, but with a value of a different data type from the Try Get function’s data type, the Result pin gives False, and you can’t get the property value.
To avoid bugs caused by inconsistent data types, it is better to always use a value of same data type for a same custom property.
You can use Strix NodeRoom struct in the same way as Strix Room struct.