MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / capture

Method capture

modules/multiplayer/editor/multiplayer_editor_plugin.cpp:62–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62bool MultiplayerEditorDebugger::capture(const String &p_message, const Array &p_data, int p_session) {
63 ERR_FAIL_COND_V(!profilers.has(p_session), false);
64 EditorNetworkProfiler *profiler = profilers[p_session];
65 if (p_message == "multiplayer:rpc") {
66 MultiplayerDebugger::RPCFrame frame;
67 frame.deserialize(p_data);
68 for (int i = 0; i < frame.infos.size(); i++) {
69 profiler->add_rpc_frame_data(frame.infos[i]);
70 }
71 return true;
72 } else if (p_message == "multiplayer:syncs") {
73 MultiplayerDebugger::ReplicationFrame frame;
74 frame.deserialize(p_data);
75 for (const KeyValue<ObjectID, MultiplayerDebugger::SyncInfo> &E : frame.infos) {
76 profiler->add_sync_frame_data(E.value);
77 }
78 Array missing = profiler->pop_missing_node_data();
79 if (missing.size()) {
80 // Asks for the object information.
81 get_session(p_session)->send_message("multiplayer:cache", missing);
82 }
83 return true;
84 } else if (p_message == "multiplayer:cache") {
85 ERR_FAIL_COND_V(p_data.size() % 3, false);
86 for (int i = 0; i < p_data.size(); i += 3) {
87 EditorNetworkProfiler::NodeInfo info;
88 info.id = p_data[i].operator ObjectID();
89 info.type = p_data[i + 1].operator String();
90 info.path = p_data[i + 2].operator String();
91 profiler->add_node_data(info);
92 }
93 return true;
94 } else if (p_message == "multiplayer:bandwidth") {
95 ERR_FAIL_COND_V(p_data.size() < 2, false);
96 profiler->set_bandwidth(p_data[0], p_data[1]);
97 return true;
98 }
99 return false;
100}
101
102void MultiplayerEditorDebugger::_profiler_activate(bool p_enable, int p_session_id) {
103 Ref<EditorDebuggerSession> session = get_session(p_session_id);

Callers

nothing calls this directly

Calls 11

add_rpc_frame_dataMethod · 0.80
add_sync_frame_dataMethod · 0.80
pop_missing_node_dataMethod · 0.80
ObjectIDMethod · 0.80
add_node_dataMethod · 0.80
set_bandwidthMethod · 0.80
sizeMethod · 0.65
hasMethod · 0.45
deserializeMethod · 0.45
send_messageMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected