R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
bot_stats.hpp
Go to the documentation of this file.
1
3#pragma once
4#include <rtype/bot.hpp>
5
6#include <chrono>
7#include <cstdint>
8#include <string>
9#include <string_view>
10
11namespace rtype {
12
14struct BotStats {
16 std::string name;
18 double seconds = 0.0;
20 std::uint64_t inputs_sent = 0;
22 std::uint64_t snapshots = 0;
24 double bytes_in_per_second = 0.0;
28 double rtt_ms = 0.0;
30 double rtt_jitter_ms = 0.0;
32 double loss_percent = 0.0;
34 double snapshot_jitter_ms = 0.0;
35};
36
38inline constexpr std::string_view bot_stats_header =
39 "bot,seconds,inputs_sent,snapshots,bytes_in_per_s,bytes_out_per_s,rtt_ms,rtt_jitter_ms,"
40 "loss_percent,snapshot_jitter_ms";
41
48[[nodiscard]] BotStats measure_bot(const Bot& bot, std::string name,
49 std::chrono::steady_clock::duration played,
50 std::chrono::steady_clock::time_point now);
51
55[[nodiscard]] std::string bot_stats_line(const BotStats& stats);
56
57} // namespace rtype
A player without a window: joins a server and holds random or recorded inputs.
A client without window nor sound: a ClientSession whose inputs are RandomInputs, or ScriptedInputs w...
Definition bot.hpp:78
R-Type game code, built on the Aegis2D engine.
Definition enemy_scripts.hpp:16
std::string bot_stats_line(const BotStats &stats)
One line of a --stats file, in the order of bot_stats_header, without its end.
BotStats measure_bot(const Bot &bot, std::string name, std::chrono::steady_clock::duration played, std::chrono::steady_clock::time_point now)
Reads what a bot measured, before it leaves.
constexpr std::string_view bot_stats_header
First line of a --stats file: the names of the columns of bot_stats_line().
Definition bot_stats.hpp:38
The link of one bot over its game, as the network benchmark reads it.
Definition bot_stats.hpp:14
std::uint64_t snapshots
Snapshot datagrams received.
Definition bot_stats.hpp:22
double bytes_in_per_second
Bytes received per second in game, headers of the protocol included.
Definition bot_stats.hpp:24
double bytes_out_per_second
Bytes sent per second in game, headers of the protocol included.
Definition bot_stats.hpp:26
double seconds
Time in game.
Definition bot_stats.hpp:18
double rtt_ms
Smoothed round trip time at the end, in milliseconds.
Definition bot_stats.hpp:28
std::uint64_t inputs_sent
Input datagrams sent.
Definition bot_stats.hpp:20
double loss_percent
Share of the server's datagrams lost over the last 2 seconds, in percent.
Definition bot_stats.hpp:32
std::string name
Player name of the bot.
Definition bot_stats.hpp:16
double rtt_jitter_ms
Its jitter, in milliseconds.
Definition bot_stats.hpp:30
double snapshot_jitter_ms
Jitter of the snapshots' arrivals over the last 2 seconds, in milliseconds.
Definition bot_stats.hpp:34