|
@@ -968,7 +968,7 @@ Left, top, right & bottom border widths and spacing between elements can also be
|
|
|
|
|
|
|
|
\page Serialization Serialization
|
|
\page Serialization Serialization
|
|
|
|
|
|
|
|
-Classes that derive from Serializable can perform automatic serialization to binary or XML format by defining \ref AttributeInfo "Attributes". Attributes are stored to the Context per class. %Scene load/save and network replication are both implemented by Node and Component deriving from Serializable.
|
|
|
|
|
|
|
+Classes that derive from Serializable can perform automatic serialization to binary or XML format by defining \ref AttributeInfo "attributes". Attributes are stored to the Context per class. %Scene load/save and network replication are both implemented by Node and Component deriving from Serializable.
|
|
|
|
|
|
|
|
The supported attribute types are all those supported by Variant. Attributes can either define a direct memory offset into the object, or setter & getter functions. Zero-based enumerations are also supported, so that the enum values can be stored as text into XML files instead of just numbers. For editing, the attributes also have human-readable names.
|
|
The supported attribute types are all those supported by Variant. Attributes can either define a direct memory offset into the object, or setter & getter functions. Zero-based enumerations are also supported, so that the enum values can be stored as text into XML files instead of just numbers. For editing, the attributes also have human-readable names.
|
|
|
|
|
|
|
@@ -1015,19 +1015,19 @@ There are some things to watch out for:
|
|
|
|
|
|
|
|
- After connecting to a server, the client should not create, update or remove non-local nodes or components on its own. However, to create client-side special effects and such, the client can freely manipulate local nodes.
|
|
- After connecting to a server, the client should not create, update or remove non-local nodes or components on its own. However, to create client-side special effects and such, the client can freely manipulate local nodes.
|
|
|
|
|
|
|
|
-- A Node's \ref Node::GetVars "user variables" VariantMap will be automatically replicated on a per-variable basis. This can be useful in transmitting data shared by several components, for example the player's score or health.
|
|
|
|
|
|
|
+- A node's \ref Node::GetVars "user variables" VariantMap will be automatically replicated on a per-variable basis. This can be useful in transmitting data shared by several components, for example the player's score or health.
|
|
|
|
|
|
|
|
- To implement interpolation, exponential smoothing of the nodes' rendering transforms is enabled on the client. It can be controlled by two properties of the Scene, the smoothing constant and the snap threshold. Snap threshold is the distance between network updates which, if exceeded, causes the node to immediately snap to the end position, instead of moving smoothly. See \ref Scene::SetSmoothingConstant "SetSmoothingConstant()" and \ref Scene::SetSnapThreshold "SetSnapThreshold()".
|
|
- To implement interpolation, exponential smoothing of the nodes' rendering transforms is enabled on the client. It can be controlled by two properties of the Scene, the smoothing constant and the snap threshold. Snap threshold is the distance between network updates which, if exceeded, causes the node to immediately snap to the end position, instead of moving smoothly. See \ref Scene::SetSmoothingConstant "SetSmoothingConstant()" and \ref Scene::SetSnapThreshold "SetSnapThreshold()".
|
|
|
|
|
|
|
|
-- Position and rotation are Node attributes, while linear and angular velocities are RigidBody attributes. To cut down on the needed network bandwidth the physics components can be created as local on the server: in this case the client will not see them at all, and will only interpolate motion based on the Node's transform changes. Replicating the actual physics components allows the client to extrapolate using its own physics simulation, and to also perform collision detection, though always non-authoritatively.
|
|
|
|
|
|
|
+- Position and rotation are Node attributes, while linear and angular velocities are RigidBody attributes. To cut down on the needed network bandwidth the physics components can be created as local on the server: in this case the client will not see them at all, and will only interpolate motion based on the node's transform changes. Replicating the actual physics components allows the client to extrapolate using its own physics simulation, and to also perform collision detection, though always non-authoritatively.
|
|
|
|
|
|
|
|
- AnimatedModel does not replicate animation by itself. Rather, AnimationController will replicate its command state (such as "fade this animation in, play that animation at 1.5x speed.") To turn off animation replication, create the AnimationController as local. To ensure that also the first animation update will be received correctly, always create the AnimatedModel component first, then the AnimationController.
|
|
- AnimatedModel does not replicate animation by itself. Rather, AnimationController will replicate its command state (such as "fade this animation in, play that animation at 1.5x speed.") To turn off animation replication, create the AnimationController as local. To ensure that also the first animation update will be received correctly, always create the AnimatedModel component first, then the AnimationController.
|
|
|
|
|
|
|
|
- Networked attributes can either be in delta update or latest data mode. Delta updates are small incremental changes and must be applied in order, which may cause increased latency if there is a stall in network message delivery eg. due to packet loss. High volume data such as position, rotation and velocities are transmitted as latest data, which does not need ordering, instead this mode simply discards any old data received out of order. Note that node and component creation (when initial attributes need to be sent) and removal can also be considered as delta updates and are therefore applied in order.
|
|
- Networked attributes can either be in delta update or latest data mode. Delta updates are small incremental changes and must be applied in order, which may cause increased latency if there is a stall in network message delivery eg. due to packet loss. High volume data such as position, rotation and velocities are transmitted as latest data, which does not need ordering, instead this mode simply discards any old data received out of order. Note that node and component creation (when initial attributes need to be sent) and removal can also be considered as delta updates and are therefore applied in order.
|
|
|
|
|
|
|
|
-- The server code orders replication update messages so that parent nodes are created and updated before their children. Remote events are queued and only sent after the replication update to ensure that if they target a newly created node, it will already exist on the receiving end. However, it is also possible to specify unordered transmission for a remote event, in which case that guarantee does not hold.
|
|
|
|
|
|
|
+- The server update logic orders replication messages so that parent nodes are created and updated before their children. Remote events are queued and only sent after the replication update to ensure that if they target a newly created node, it will already exist on the receiving end. However, it is also possible to specify unordered transmission for a remote event, in which case that guarantee does not hold.
|
|
|
|
|
|
|
|
-- The \ref Node::SetOwner "owner property" of a node can be set in server code to specify the owning Connection (for example, the player that is controlling a specific game object.) This property is not replicated to the client. Messages or remote events can be used instead to tell the players what object they control.
|
|
|
|
|
|
|
+- Nodes have the concept of the \ref Node::SetOwner "owner connection" (for example the player that is controlling a specific game object), which can be set in server code. This property is not replicated to the client. Messages or remote events can be used instead to tell the players what object they control.
|
|
|
|
|
|
|
|
- At least for now, there is no built-in client-side prediction.
|
|
- At least for now, there is no built-in client-side prediction.
|
|
|
|
|
|
|
@@ -1035,13 +1035,13 @@ There are some things to watch out for:
|
|
|
|
|
|
|
|
%Scene replication includes a simple, distance-based interest management mechanism for reducing bandwidth use.
|
|
%Scene replication includes a simple, distance-based interest management mechanism for reducing bandwidth use.
|
|
|
|
|
|
|
|
-For each Node the following values can be configured: \ref Node::SetPriority "Priority", \ref Node::SetPriorityDistanceFactor "Priority Distance Factor", and \ref Node::SetMinPriority "Minimum Priority".
|
|
|
|
|
|
|
+For each Node the following parameters can be set: \ref Node::SetPriority "priority", \ref Node::SetPriorityDistanceFactor "priority distance factor", and \ref Node::SetMinPriority "minimum priority".
|
|
|
|
|
|
|
|
-During each server update, a current priority value is calculated as Priority - Priority Distance Factor * Distance. Additionally, it can never go lower than the minimum priority. This value is then added to an update accumulator. Whenever the update accumulator reaches 100.0, the attribute changes to the node and its components are sent, and the accumulator is reset.
|
|
|
|
|
|
|
+During each server update, a current priority value is calculated as "priority - priority distance factor * distance." Additionally, it can never go lower than the minimum priority. This value is then added to an update accumulator. Whenever the update accumulator reaches 100.0, the attribute changes to the node and its components are sent, and the accumulator is reset.
|
|
|
|
|
|
|
|
-The default values are Priority 100.0, Priority Distance Factor 0.0, and Minimum Priority 0.0, which means that by default, an update is always sent. Additionally, there is a rule that if the node's owner connection is set, the owner always receives updates at full frequency.
|
|
|
|
|
|
|
+The default values are priority 100.0, priority distance factor 0.0, and minimum priority 0.0. This means that by default an update is always sent. Additionally, there is a rule that if the node's owner connection is set, the owner always receives updates at full frequency. Note that like the owner connection, the interest management parameters are not replicated to the client.
|
|
|
|
|
|
|
|
-Knowing the distance requires the client telling its current observer position (typically, either the camera's or the player character's world position.) This is accomplished by the client code calling \ref Connection::SetPosition "SetPosition()" on the server connection.
|
|
|
|
|
|
|
+Calculating the distance requires the client to tell its current observer position (typically, either the camera's or the player character's world position.) This is accomplished by the client code calling \ref Connection::SetPosition "SetPosition()" on the server connection.
|
|
|
|
|
|
|
|
For now, creation and removal of nodes is always sent immediately, without consulting the interest management system. This is based on the assumption that nodes' motion updates consume the most bandwidth.
|
|
For now, creation and removal of nodes is always sent immediately, without consulting the interest management system. This is based on the assumption that nodes' motion updates consume the most bandwidth.
|
|
|
|
|
|