3#include <SFML/System/Time.hpp>
7#include "graphics/graphics.h"
16 float currentTime = 0.0f;
17 std::unique_ptr<Packet> packet =
nullptr;
27 explicit SimulationServer(std::array<std::unique_ptr<SimulationClient>, 2>& clients);
28 void Begin()
override;
29 void Update(sf::Time dt)
override;
31 void DrawImGui()
override;
32 void PutPacketInReceiveQueue(std::unique_ptr<Packet> packet,
bool unreliable);
33 void SendReliablePacket(std::unique_ptr<Packet> packet)
override;
34 void SendUnreliablePacket(std::unique_ptr<Packet> packet)
override;
36 void PutPacketInSendingQueue(std::unique_ptr<Packet> packet);
37 void ProcessReceivePacket(std::unique_ptr<Packet> packet);
41 std::vector<DelayPacket> receivedPackets_;
42 std::vector<DelayPacket> sentPackets_;
43 std::array<std::unique_ptr<SimulationClient>,
maxPlayerNmb>& clients_;
44 float avgDelay_ = 0.25f;
45 float marginDelay_ = 0.1f;
46 float packetLoss_ = 0.0f;
DrawImGuiInterface is an interface used by the Engine to be called when the game loop is drawing ImGu...
Definition: graphics.h:23
Server is an interface to a network or simulated server. It owns a simple GameManager.
Definition: server.h:15
SimulationClient is a Client that uses simulated sockets with a direct reference to the server.
Definition: simulation_client.h:16
SimulationServer is a Server that delays Packet internally before "receiving" them and then sends the...
Definition: simulation_server.h:25
ClientId
ClientId is a type used to define the client identification. It is given by the server to clients.
Definition: game_globals.h:31
std::uint8_t PlayerNumber
PlayerNumber is a type used to define the number of the player. Starting from 0 to maxPlayerNmb.
Definition: game_globals.h:22
constexpr std::uint32_t maxPlayerNmb
mmaxPlayerNmb is a integer constant that defines the maximum number of player per game
Definition: game_globals.h:37
DelayPacket is a struct used by the SimulationServer to delay received Packet.
Definition: simulation_server.h:15