This commit is contained in:
Spartan322
2025-04-19 07:12:16 -04:00
5209 changed files with 229124 additions and 66199 deletions

View File

@@ -152,9 +152,7 @@ void MultiplayerDebugger::BandwidthProfiler::tick(double p_frame_time, double p_
int incoming_bandwidth = bandwidth_usage(bandwidth_in, bandwidth_in_ptr);
int outgoing_bandwidth = bandwidth_usage(bandwidth_out, bandwidth_out_ptr);
Array arr;
arr.push_back(incoming_bandwidth);
arr.push_back(outgoing_bandwidth);
Array arr = { incoming_bandwidth, outgoing_bandwidth };
EngineDebugger::get_singleton()->send_message("multiplayer:bandwidth", arr);
}
}
@@ -162,8 +160,7 @@ void MultiplayerDebugger::BandwidthProfiler::tick(double p_frame_time, double p_
// RPCProfiler
Array MultiplayerDebugger::RPCFrame::serialize() {
Array arr;
arr.push_back(infos.size() * 6);
Array arr = { infos.size() * 6 };
for (int i = 0; i < infos.size(); ++i) {
arr.push_back(uint64_t(infos[i].node));
arr.push_back(infos[i].node_path);
@@ -200,7 +197,7 @@ void MultiplayerDebugger::RPCProfiler::init_node(const ObjectID p_node) {
}
rpc_node_data.insert(p_node, RPCNodeInfo());
rpc_node_data[p_node].node = p_node;
rpc_node_data[p_node].node_path = Object::cast_to<Node>(ObjectDB::get_instance(p_node))->get_path();
rpc_node_data[p_node].node_path = ObjectDB::get_instance<Node>(p_node)->get_path();
}
void MultiplayerDebugger::RPCProfiler::toggle(bool p_enable, const Array &p_opts) {
@@ -272,8 +269,7 @@ bool MultiplayerDebugger::SyncInfo::read_from_array(const Array &p_arr, int p_of
}
Array MultiplayerDebugger::ReplicationFrame::serialize() {
Array arr;
arr.push_back(infos.size() * 7);
Array arr = { infos.size() * 7 };
for (const KeyValue<ObjectID, SyncInfo> &E : infos) {
E.value.write_to_array(arr);
}
@@ -306,7 +302,7 @@ void MultiplayerDebugger::ReplicationProfiler::add(const Array &p_data) {
const String what = p_data[0];
const ObjectID id = p_data[1];
const uint64_t size = p_data[2];
MultiplayerSynchronizer *sync = Object::cast_to<MultiplayerSynchronizer>(ObjectDB::get_instance(id));
MultiplayerSynchronizer *sync = ObjectDB::get_instance<MultiplayerSynchronizer>(id);
ERR_FAIL_NULL(sync);
if (!sync_data.has(id)) {
sync_data[id] = SyncInfo(sync);