From 1d237a3a2cc897b4c13b52e3a8a399f418506bd2 Mon Sep 17 00:00:00 2001 From: MiTHRAL Date: Fri, 28 Aug 2026 13:30:31 -0400 Subject: [PATCH] netcode-revival: verbose game-traffic telemetry on the relay With --verbose, the relay logs a windowed summary of forwarded game datagrams ('game traffic: N datagram(s) relayed to M member(s) in room 'XXX'') so the game's own RakNet netcode is observable in the relay log - distinct from ghost pose joins. Counted per 2s window to avoid per-packet spam. --- src/native/skate3_native_ghost_relay.cpp | 15 +++++++++++++++ src/native/skate3_native_ghost_relay.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/native/skate3_native_ghost_relay.cpp b/src/native/skate3_native_ghost_relay.cpp index af2fdb8..1fda755 100644 --- a/src/native/skate3_native_ghost_relay.cpp +++ b/src/native/skate3_native_ghost_relay.cpp @@ -355,6 +355,7 @@ void GhostRelay::HandlePacket(const GhostAddr& from, const PacketBuf& p, GamePayload* fwd = reinterpret_cast(out.payload); fwd->src_virtual_ip = me->virtual_ip; const uint16_t size = PacketSize(out); + uint32_t recipients = 0; for (Client& c : clients_) { if (&c == me || c.refused) { continue; @@ -367,6 +368,20 @@ void GhostRelay::HandlePacket(const GhostAddr& from, const PacketBuf& p, continue; } GhostSockSendTo(sock_, c.addr, &out, size); + ++recipients; + } + // Verbose: a windowed summary of game datagrams relayed, so the game's + // own netcode traffic is visible in the log. + if (verbose_.load(std::memory_order_relaxed) && recipients != 0) { + ++game_forwards_; + if (now - last_game_log_ >= 2.0 || game_forwards_ == 1) { + GHOST_RELAY_INFO("game traffic: {} datagram(s) relayed to {} " + "member(s) in room '{}'", + game_forwards_, recipients, + std::string(me->room, me->room_len)); + last_game_log_ = now; + game_forwards_ = 0; + } } break; } diff --git a/src/native/skate3_native_ghost_relay.h b/src/native/skate3_native_ghost_relay.h index 82d2a72..074146a 100644 --- a/src/native/skate3_native_ghost_relay.h +++ b/src/native/skate3_native_ghost_relay.h @@ -84,6 +84,11 @@ class GhostRelay { bool locked_ = false; char locked_room_[kGhostMaxRoomLen] = {}; uint8_t locked_room_len_ = 0; + // Verbose game-traffic telemetry (netcode-revival): count forwarded game + // datagrams and log a windowed summary so the game's own RakNet traffic is + // observable without spamming the log per packet. + uint32_t game_forwards_ = 0; + double last_game_log_ = 0.0; }; } // namespace skate3::native_ghost \ No newline at end of file