Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::net::NetDiagnostics Class Reference

Session-local recorder for recent multiplayer diagnostics and aggregate counters. More...

#include <NetDiagnostics.h>

Public Member Functions

 NetDiagnostics (bool enabled=true)
 Creates a diagnostics recorder with the given default enabled state.
 
void beginSession (std::string_view ownerTag, bool enabled=true)
 Starts a new diagnostics session and clears previous session state.
 
void endSession ()
 Ends the current diagnostics session and finalizes duration fields.
 
void recordEvent (const NetEvent &event)
 Records a fully populated recent event.
 
void recordPacketSent (EMsgType type, uint8_t peerId, uint8_t channelId, std::size_t bytes, NetPacketResult result=NetPacketResult::Ok)
 Records one outgoing packet attempt and updates packet summary totals.
 
void recordPacketRecv (EMsgType type, uint8_t peerId, uint8_t channelId, std::size_t bytes, NetPacketResult result=NetPacketResult::Ok)
 Records one incoming packet attempt and updates packet summary totals.
 
void recordMalformedPacketRecv (uint8_t peerId, uint8_t channelId, std::size_t bytes, std::string_view note={})
 Records an incoming packet that failed before typed dispatch, such as a malformed header.
 
void recordPeerLifecycle (NetPeerLifecycleType type, uint8_t peerId, uint32_t transportPeerId, std::string_view note={})
 Records a structured peer lifecycle event.
 
void recordInputPacketReceived ()
 Records one input packet that was received and parsed successfully.
 
void recordInputPacketFullyStale (uint32_t count=1)
 Records a fully stale input packet whose newest sequence was already consumed.
 
void recordInputEntriesTooLate (uint32_t count)
 Records input entries that arrived after their sequence had already been processed.
 
void recordInputEntriesTooLateDirect (uint32_t count)
 Records late entries that were the newest/direct command of their received batch.
 
void recordInputEntriesTooLateBuffered (uint32_t count)
 Records late entries that arrived only as redundant buffered history.
 
void recordInputEntriesTooFarAhead (uint32_t count)
 Records input entries rejected for being too far ahead of the accepted receive window.
 
void recordSimulationGap (uint8_t peerId, uint32_t inputSeq, uint8_t heldButtons, uint32_t serverTick)
 Records a consume deadline miss that required reusing the previous buttons for a gameplay peer.
 
void recordDirectDeadlineConsume (uint8_t peerId, uint32_t inputSeq)
 Records a direct consume where the exact seq was present by deadline with a direct/newest batch entry.
 
void recordBufferedDeadlineRecovery (uint8_t peerId, uint32_t inputSeq, uint32_t serverTick)
 Records a buffered deadline recovery where redundant history supplied the exact seq before consume time.
 
void recordBombPlaced ()
 Records one authoritative bomb placement accepted by the server simulation.
 
void recordBricksDestroyed (uint32_t count)
 Records bricks destroyed by one authoritative explosion resolution.
 
void recordRoundEnded (std::optional< uint8_t > winnerPlayerId, bool endedInDraw, uint32_t serverTick)
 Records one authoritative round-end outcome.
 
void samplePeerTransport (uint8_t peerId, uint32_t rttMs, uint32_t rttVarianceMs, uint32_t packetLossPermille, uint32_t queuedReliable, uint32_t queuedUnreliable)
 Stores the latest sampled transport health values for a peer.
 
void samplePeerInputContinuity (uint8_t peerId, uint32_t lastReceivedInputSeq, uint32_t lastProcessedInputSeq)
 Stores the latest input progression cursors for a peer.
 
void recordServerFlowState (std::string_view stateName, bool idle, uint32_t serverTick, uint32_t matchId=0)
 Records the current coarse server flow state and derived idle flag.
 
void advanceTick ()
 Advances per-session tick bookkeeping.
 
void recordSessionConfig (ServerSessionConfig config)
 Captures static server session config for later reporting output.
 
nlohmann::json toJson () const
 Serializes the current diagnostics state as JSON.
 
bool writeJsonReport (std::string_view filePath) const
 Writes a machine-readable JSON session report to disk.
 

Detailed Description

Session-local recorder for recent multiplayer diagnostics and aggregate counters.

Recording is manual and call-site driven. The class does not inspect ENet state or gameplay state on its own; it stores what the owning network flow explicitly reports to it.

Member Function Documentation

◆ beginSession()

void bomberman::net::NetDiagnostics::beginSession ( std::string_view  ownerTag,
bool  enabled = true 
)

Starts a new diagnostics session and clears previous session state.

Parameters
ownerTagShort human-readable label for the owner of this recorder.
enabledWhether diagnostics recording should be enabled for this session.

◆ recordEvent()

void bomberman::net::NetDiagnostics::recordEvent ( const NetEvent event)

Records a fully populated recent event.

This is the lowest-level extension point for future diagnostics work. If event.timestampMs is zero, the recorder stamps it with the current monotonic time.


The documentation for this class was generated from the following files: