summaryrefslogtreecommitdiffstats
path: root/modules/multiplayer/scene_multiplayer.h
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-16 22:48:12 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-17 03:14:21 +0100
commit92ed27d8f66c207125f2fbb9a8c988863d54bf0d (patch)
treeea82269b6d0eb415c6673ced2b6d30a4e1d5997f /modules/multiplayer/scene_multiplayer.h
parent2846ea1ffafddfc447036b37d255f72cb278b677 (diff)
downloadredot-engine-92ed27d8f66c207125f2fbb9a8c988863d54bf0d.tar.gz
[MP] Improve network profiler.
Fix RPC profiler and add average RPC size. Improve bandwidth debugger to account for all multiplayer traffic (excluding the lower level peer transformations).
Diffstat (limited to 'modules/multiplayer/scene_multiplayer.h')
-rw-r--r--modules/multiplayer/scene_multiplayer.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/multiplayer/scene_multiplayer.h b/modules/multiplayer/scene_multiplayer.h
index b0ecc48f8c..da8c762134 100644
--- a/modules/multiplayer/scene_multiplayer.h
+++ b/modules/multiplayer/scene_multiplayer.h
@@ -103,6 +103,15 @@ private:
Ref<SceneReplicationInterface> replicator;
Ref<SceneRPCInterface> rpc;
+#ifdef DEBUG_ENABLED
+ _FORCE_INLINE_ void _profile_bandwidth(const String &p_what, int p_value);
+ _FORCE_INLINE_ Error _send(const uint8_t *p_packet, int p_packet_len); // Also profiles.
+#else
+ _FORCE_INLINE_ Error _send(const uint8_t *p_packet, int p_packet_len) {
+ return multiplayer_peer->put_packet(p_packet, p_packet_len);
+ }
+#endif
+
protected:
static void _bind_methods();
@@ -163,10 +172,6 @@ public:
Ref<SceneCacheInterface> get_path_cache() { return cache; }
-#ifdef DEBUG_ENABLED
- void profile_bandwidth(const String &p_inout, int p_size);
-#endif
-
SceneMultiplayer();
~SceneMultiplayer();
};