![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
A helper class that measure latency between client/server. More...
#include <C_client.hpp>
Public Types | |
enum | Stats : uint8_t { HAVE_EXTERNAL_TIMESTAMP = 1 << 0 } |
Public Member Functions | |
void | pack (TransmissionPacketPtr &tPacket) |
Pack the required data by the planner to the client/server. | |
void | unpack (FluxPacket *packet, Client &client) |
Unpack the data received by another client/server planner. | |
std::optional< FullTimestampOffset > | getClockOffset () const |
Retrieve the clock offset. | |
std::optional< Latency_ms > | getLatency () const |
Retrieve the latency. | |
std::optional< Latency_ms > | getOtherSideLatency () const |
Retrieve the other side latency. | |
std::optional< Latency_ms > | getRoundTripTime () const |
Retrieve the RTT (Round Trip Time) | |
A helper class that measure latency between client/server.
This class is called "one-way latency" but it actually compute the Round Trip Time minus a latency corrector divided by 2.
|
nodiscard |
Retrieve the clock offset.
The clock offset represent the delta time between 2 computers clocks. It is useful in order to predicate some data.
|
nodiscard |
Retrieve the latency.
|
nodiscard |
Retrieve the other side latency.
This is the latency computed at the other end (client or server)
|
nodiscard |
Retrieve the RTT (Round Trip Time)
CLIENT
FIRST_PACKET LAST_PACKET O O | |
SERVER
| | -----------------------> RTT (Round Trip Time) ms | | | | | | -------> Server To Client (STOC) time ms -------> Client To Server (CTOS) time ms | | -------------> Latency corrector computed by the server
void fge::net::OneWayLatencyPlanner::pack | ( | TransmissionPacketPtr & | tPacket | ) |
Pack the required data by the planner to the client/server.
tPacket | A TransmissionPacket |
void fge::net::OneWayLatencyPlanner::unpack | ( | FluxPacket * | packet, |
Client & | client ) |
Unpack the data received by another client/server planner.
packet | A received packet |
client | A client |