diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-10-08 20:50:19 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-10-27 18:08:58 +0200 |
commit | 7536d15fe3c5991b79aa54f0db3cf110e882e87a (patch) | |
tree | 4552f62d1fa5054828e47132cd785322abcea0cf /modules/multiplayer/scene_replication_interface.cpp | |
parent | 03e5de37ae3228de26e7b83888c542a9f400b5d9 (diff) |
[MP] Let MultiplayerAPI handle packet relaying and peer signaling.
MultiplayerPeer changes:
- Adds is_server_relay_supported virtual method
Informs the upper MultiplayerAPI layer if it can signal peers connected
to the server to other clients, and perform packet relaying among them.
- Adds get_packet_channel and get_packet_mode virtual methods
Allows the MultiplayerAPI to retrieve the channel and transfer modes to
use when relaying the last received packet.
SceneMultiplayerPeer changes:
- Implement peer signaling and packet relaying when the MultiplayerPeer
advertise they are supported.
ENet, WebRTC, WebSocket changes:
- Removed custom code for relaying from WebSocket and ENet, and let it
be handled by the upper layer.
- Update WebRTC to split create_client, create_server, and create_mesh,
with the latter behaving like the old initialize with
"server_compatibility = false", and the first two supporting the upper
layer relaying protocol.
Diffstat (limited to 'modules/multiplayer/scene_replication_interface.cpp')
-rw-r--r-- | modules/multiplayer/scene_replication_interface.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index 8359580805..da425076a4 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -370,10 +370,9 @@ Error SceneReplicationInterface::_send_raw(const uint8_t *p_buffer, int p_size, #endif Ref<MultiplayerPeer> peer = multiplayer->get_multiplayer_peer(); - peer->set_target_peer(p_peer); peer->set_transfer_channel(0); peer->set_transfer_mode(p_reliable ? MultiplayerPeer::TRANSFER_MODE_RELIABLE : MultiplayerPeer::TRANSFER_MODE_UNRELIABLE); - return peer->put_packet(p_buffer, p_size); + return multiplayer->send_command(p_peer, p_buffer, p_size); } Error SceneReplicationInterface::_make_spawn_packet(Node *p_node, MultiplayerSpawner *p_spawner, int &r_len) { |