Implement optional object replication
This commit is contained in:
@@ -80,7 +80,11 @@ void NetworkReplicationNode::Update(NetworkReplicationHierarchyUpdateResult* res
|
|||||||
const float networkFPS = NetworkManager::NetworkFPS / result->ReplicationScale;
|
const float networkFPS = NetworkManager::NetworkFPS / result->ReplicationScale;
|
||||||
for (NetworkReplicationHierarchyObject& obj : Objects)
|
for (NetworkReplicationHierarchyObject& obj : Objects)
|
||||||
{
|
{
|
||||||
if (obj.ReplicationFPS <= 0.0f)
|
if (obj.ReplicationFPS < 0.0f)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (obj.ReplicationFPS == 0.0f)
|
||||||
{
|
{
|
||||||
// Always relevant
|
// Always relevant
|
||||||
result->AddObject(obj.Object);
|
result->AddObject(obj.Object);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ API_STRUCT(NoDefault, Namespace = "FlaxEngine.Networking") struct FLAXENGINE_API
|
|||||||
|
|
||||||
// The object to replicate.
|
// The object to replicate.
|
||||||
API_FIELD() ScriptingObjectReference<ScriptingObject> Object;
|
API_FIELD() ScriptingObjectReference<ScriptingObject> Object;
|
||||||
// The target amount of the replication updates per second (frequency of the replication). Constrained by NetworkManager::NetworkFPS. Use 0 for 'always relevant' object.
|
// The target amount of the replication updates per second (frequency of the replication). Constrained by NetworkManager::NetworkFPS. Use 0 for 'always relevant' object and < 0 for 'never relevant' objects that would only get synched on client join once.
|
||||||
API_FIELD() float ReplicationFPS = 60;
|
API_FIELD() float ReplicationFPS = 60;
|
||||||
// The minimum distance from the player to the object at which it can process replication. For example, players further away won't receive object data. Use 0 if unused.
|
// The minimum distance from the player to the object at which it can process replication. For example, players further away won't receive object data. Use 0 if unused.
|
||||||
API_FIELD() float CullDistance = 15000;
|
API_FIELD() float CullDistance = 15000;
|
||||||
|
|||||||
Reference in New Issue
Block a user