summaryrefslogtreecommitdiff
path: root/core/io/multiplayer_api.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-02-12 16:56:17 +0100
committerGitHub <noreply@github.com>2020-02-12 16:56:17 +0100
commit0f90ddbcf4489f46132ef48c1611d5c14ff2b776 (patch)
tree40b903ce308de03219eb1ce986fdf084ba711942 /core/io/multiplayer_api.h
parent525c40a488c07ac072469cf9a694de77672d27bc (diff)
parenteb07e87981d55fac8299b6db55fb5c29e0bfa49b (diff)
Merge pull request #35522 from AndreaCatania/rpc_opt_2
Optmized data sent during RPC and RSet calls.
Diffstat (limited to 'core/io/multiplayer_api.h')
-rw-r--r--core/io/multiplayer_api.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index c9f127b6b2..6672cfe155 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -98,23 +98,37 @@ protected:
void _process_packet(int p_from, const uint8_t *p_packet, int p_packet_len);
void _process_simplify_path(int p_from, const uint8_t *p_packet, int p_packet_len);
void _process_confirm_path(int p_from, const uint8_t *p_packet, int p_packet_len);
- Node *_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len);
- void _process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
- void _process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
+ Node *_process_get_node(int p_from, const uint8_t *p_packet, uint32_t p_node_target, int p_packet_len);
+ void _process_rpc(Node *p_node, const uint16_t p_rpc_method_id, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
+ void _process_rset(Node *p_node, const uint16_t p_rpc_property_id, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len);
void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount);
- bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_target);
+ bool _send_confirm_path(Node *p_node, NodePath p_path, PathSentCache *psc, int p_target);
+
+ Error _encode_and_compress_variant(const Variant &p_variant, uint8_t *p_buffer, int &r_len);
+ Error _decode_and_decompress_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len);
public:
enum NetworkCommands {
- NETWORK_COMMAND_REMOTE_CALL,
+ NETWORK_COMMAND_REMOTE_CALL = 0,
NETWORK_COMMAND_REMOTE_SET,
NETWORK_COMMAND_SIMPLIFY_PATH,
NETWORK_COMMAND_CONFIRM_PATH,
NETWORK_COMMAND_RAW,
};
+ enum NetworkNodeIdCompression {
+ NETWORK_NODE_ID_COMPRESSION_8 = 0,
+ NETWORK_NODE_ID_COMPRESSION_16,
+ NETWORK_NODE_ID_COMPRESSION_32,
+ };
+
+ enum NetworkNameIdCompression {
+ NETWORK_NAME_ID_COMPRESSION_8 = 0,
+ NETWORK_NAME_ID_COMPRESSION_16,
+ };
+
enum RPCMode {
RPC_MODE_DISABLED, // No rpc for this method, calls to this will be blocked (default)