nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
round_trip.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_ROUND_TRIP_H_
2#define NANOMMO_CLIENT_ROUND_TRIP_H_
3
4#include <cstdint>
5#include <map>
6
7namespace nanommo {
8
9/// How long the server takes to apply an input of ours and say so: from
10/// sending each numbered input to the world that says it was applied.
11class RoundTrip {
12 public:
13 /// We sent the input of that sequence, at the time, in seconds.
14 void Sent(uint32_t sequence, double now);
15
16 /// The world says the server applied the inputs up to acked.
17 void Acked(uint32_t acked, double now);
18
19 /// In milliseconds, smoothed over the last few, or 0 before any.
20 float milliseconds() const { return milliseconds_; }
21
22 private:
23 std::map<uint32_t, double> sent_;
24 float milliseconds_ = 0.0f;
25};
26
27/// The round trip, in the top right, at the top given, right-aligned, under
28/// the minimap. Returns how tall it is, for what goes under it.
29float DrawRoundTrip(float milliseconds, float top);
30
31} // namespace nanommo
32
33#endif // NANOMMO_CLIENT_ROUND_TRIP_H_
void Sent(uint32_t sequence, double now)
We sent the input of that sequence, at the time, in seconds.
Definition round_trip.cc:24
float milliseconds() const
In milliseconds, smoothed over the last few, or 0 before any.
Definition round_trip.h:20
void Acked(uint32_t acked, double now)
The world says the server applied the inputs up to acked.
Definition round_trip.cc:26
Definition chat.cc:9
float DrawRoundTrip(float milliseconds, float top)
Definition round_trip.cc:39