diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-03-29 22:35:03 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-03-29 23:11:04 +0100 |
commit | 4b973f451e4c5d929baeac7e86ebd3cb3e4c60a8 (patch) | |
tree | 37e649b99987a605f890bb3c7d5fe0be5f8a372c /modules/multiplayer/scene_cache_interface.h | |
parent | 29b3d9e9e538f0aa8effc8ad8bf19a2915292a89 (diff) | |
download | redot-engine-4b973f451e4c5d929baeac7e86ebd3cb3e4c60a8.tar.gz |
[MP] Gracefully handle cache confirmation of deleted nodes
It's possible that after sending a cached node reference (e.g. RPC or
static MultiplayerSynchronizer) the reference node is removed from tree
before the remote peer(s) can confirm the referenced path.
To better detect that case, and avoid spamming errors when it happens,
this commit modifies the multiplayer API caching protocol, to send the
received ID instead of the Node path when sending the confirmation
packet.
**This is a breaking change** because it makes the runtime multiplayer
protocol incompatible with previous versions of Godot.
Diffstat (limited to 'modules/multiplayer/scene_cache_interface.h')
-rw-r--r-- | modules/multiplayer/scene_cache_interface.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/multiplayer/scene_cache_interface.h b/modules/multiplayer/scene_cache_interface.h index ab4a20c078..73d6bde6ef 100644 --- a/modules/multiplayer/scene_cache_interface.h +++ b/modules/multiplayer/scene_cache_interface.h @@ -44,7 +44,7 @@ private: //path sent caches struct NodeCache { - int cache_id; + int cache_id = 0; HashMap<int, int> recv_ids; // peer id, remote cache id HashMap<int, bool> confirmed_peers; // peer id, confirmed }; @@ -55,6 +55,7 @@ private: }; HashMap<ObjectID, NodeCache> nodes_cache; + HashMap<int, ObjectID> assigned_ids; HashMap<int, PeerInfo> peers_info; int last_send_cache_id = 1; |