summaryrefslogtreecommitdiffstats
path: root/modules/multiplayer/scene_cache_interface.h
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-07-30 13:21:36 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-07-31 19:32:32 +0200
commit90d5d260265a8092624ad3af91c12171bc1e9b7e (patch)
treeefb9eca833e7e303284bb5bc360a177ffad2b0c0 /modules/multiplayer/scene_cache_interface.h
parent0e9caa2d9cb20737f8dcf08b75fcf2a78d980569 (diff)
downloadredot-engine-90d5d260265a8092624ad3af91c12171bc1e9b7e.tar.gz
[MP] Partially revert cache cleanup, track paths as fallback
Cleaning up remote NodePath cache is not trivial since the visibility API allows for certain nodes to be despawned (and re-spawned) on some peers while being retained in the authority. This means that from the server point of view, the node has not changed, and the path simplification protocol won't be run again after respawning. While we can track this information for synchronizers via the replication API, we can't easily track this information for potential child nodes that use RPCs (I'm convinced it is doable, but we need to track the whole dependency tree which would require some more complex refactoring). This commit partially reverts some of the cache cleanup logic to always retain remote IDs, and adds a NodePath lookup fallback when the ObjectID is invalid.
Diffstat (limited to 'modules/multiplayer/scene_cache_interface.h')
-rw-r--r--modules/multiplayer/scene_cache_interface.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/multiplayer/scene_cache_interface.h b/modules/multiplayer/scene_cache_interface.h
index 73d6bde6ef..fbe618f4ad 100644
--- a/modules/multiplayer/scene_cache_interface.h
+++ b/modules/multiplayer/scene_cache_interface.h
@@ -49,8 +49,18 @@ private:
HashMap<int, bool> confirmed_peers; // peer id, confirmed
};
+ struct RecvNode {
+ ObjectID oid;
+ NodePath path;
+
+ RecvNode(const ObjectID &p_oid, const NodePath &p_path) {
+ oid = p_oid;
+ path = p_path;
+ }
+ };
+
struct PeerInfo {
- HashMap<int, ObjectID> recv_nodes; // remote cache id, ObjectID
+ HashMap<int, RecvNode> recv_nodes; // remote cache id, (ObjectID, NodePath)
HashSet<ObjectID> sent_nodes;
};