You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
[MP] Implement "watched" properties.
Checked at "delta_interval" (default = every frame), synchronized (reliably) if changes are detected.
This commit is contained in:
@@ -62,6 +62,7 @@ private:
|
||||
struct PeerInfo {
|
||||
HashSet<ObjectID> sync_nodes;
|
||||
HashSet<ObjectID> spawn_nodes;
|
||||
HashMap<ObjectID, uint64_t> last_watch_usecs;
|
||||
HashMap<uint32_t, ObjectID> recv_sync_ids;
|
||||
HashMap<uint32_t, ObjectID> recv_nodes;
|
||||
uint16_t last_sent_sync = 0;
|
||||
@@ -88,12 +89,17 @@ private:
|
||||
SceneMultiplayer *multiplayer = nullptr;
|
||||
PackedByteArray packet_cache;
|
||||
int sync_mtu = 1350; // Highly dependent on underlying protocol.
|
||||
int delta_mtu = 65535;
|
||||
|
||||
TrackedNode &_track(const ObjectID &p_id);
|
||||
void _untrack(const ObjectID &p_id);
|
||||
void _node_ready(const ObjectID &p_oid);
|
||||
|
||||
void _send_sync(int p_peer, const HashSet<ObjectID> p_synchronizers, uint16_t p_sync_net_time, uint64_t p_msec);
|
||||
bool _verify_synchronizer(int p_peer, MultiplayerSynchronizer *p_sync, uint32_t &r_net_id);
|
||||
MultiplayerSynchronizer *_find_synchronizer(int p_peer, uint32_t p_net_ida);
|
||||
|
||||
void _send_sync(int p_peer, const HashSet<ObjectID> p_synchronizers, uint16_t p_sync_net_time, uint64_t p_usec);
|
||||
void _send_delta(int p_peer, const HashSet<ObjectID> p_synchronizers, uint64_t p_usec, const HashMap<ObjectID, uint64_t> p_last_watch_usecs);
|
||||
Error _make_spawn_packet(Node *p_node, MultiplayerSpawner *p_spawner, int &r_len);
|
||||
Error _make_despawn_packet(Node *p_node, int &r_len);
|
||||
Error _send_raw(const uint8_t *p_buffer, int p_size, int p_peer, bool p_reliable);
|
||||
@@ -127,9 +133,16 @@ public:
|
||||
Error on_spawn_receive(int p_from, const uint8_t *p_buffer, int p_buffer_len);
|
||||
Error on_despawn_receive(int p_from, const uint8_t *p_buffer, int p_buffer_len);
|
||||
Error on_sync_receive(int p_from, const uint8_t *p_buffer, int p_buffer_len);
|
||||
Error on_delta_receive(int p_from, const uint8_t *p_buffer, int p_buffer_len);
|
||||
|
||||
bool is_rpc_visible(const ObjectID &p_oid, int p_peer) const;
|
||||
|
||||
void set_max_sync_packet_size(int p_size);
|
||||
int get_max_sync_packet_size() const;
|
||||
|
||||
void set_max_delta_packet_size(int p_size);
|
||||
int get_max_delta_packet_size() const;
|
||||
|
||||
SceneReplicationInterface(SceneMultiplayer *p_multiplayer) {
|
||||
multiplayer = p_multiplayer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user