QtCraft API C++ classes QML types Handbook

QcDebugJson Namespace

The debug data as JSON (decision E-225), the same numbers the debug display shows: "client" (position, light, target, entities, chunks, memory, latency), "frame" (graphical game only: FPS and the frame phases with mean and maximum in milliseconds, meshing) and "server" (tick phases, tick, lateness, counts; once the server sent them). More...

Header: #include <clientcore/debug/QcDebugJson.h>

Functions

QJsonObject clientJson(const QcDebugSnapshot &snapshot)
QJsonObject frameJson(const QcDebugSnapshot::Frame &frame)
QJsonObject latencyJson(const std::optional<QcRoundTripSummary> &latency)
QJsonObject serverJson(const QcMsg::ServerDebug &server)
QJsonObject toJson(const QcDebugSnapshot &snapshot)

Detailed Description

Used by the control command debug, the statistics log (QTCRAFT_STATS) and documented in docs/Steuerschnittstelle.md.

Function Documentation

QJsonObject QcDebugJson::clientJson(const QcDebugSnapshot &snapshot)

Returns the "client" part of snapshot.

QJsonObject QcDebugJson::frameJson(const QcDebugSnapshot::Frame &frame)

Returns the "frame" part: frame's rate, phases and meshing.

QJsonObject QcDebugJson::latencyJson(const std::optional<QcRoundTripSummary> &latency)

Returns the round trip to the server, latency (decision E-886): {"measured":false} before the first answer, else {"measured":true,"smoothedMs","lastMs","minMs","maxMs","jitterMs","samples","pendingMs"} over the last 10 s; pendingMs is the age of a probe late beyond the smoothed value (a lower bound), else 0.

QJsonObject QcDebugJson::serverJson(const QcMsg::ServerDebug &server)

Returns the "server" part: the phases, tick, lateness and counts of server.

QJsonObject QcDebugJson::toJson(const QcDebugSnapshot &snapshot)

Returns the whole snapshot: {"client", "frame" (when there is one), "server" (when there is one)}.