WIP Packet loss identification. Put packetID in message

This commit is contained in:
stiffly
2015-12-09 17:43:36 +01:00
parent 0807a7d0ae
commit 4de613814b
7 changed files with 51 additions and 7 deletions
+5
View File
@@ -42,12 +42,17 @@ private:
void ParseServerPing();
void ParseSnapshot(char* data, size_t length);
void CreateNewPlayer(int i);
void IdentifyPacketLoss();
// udp stuff
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
boost::asio::io_service m_IOService;
boost::asio::ip::udp::socket m_Socket;
// Packet loss logic
unsigned int m_PacketID = 0;
unsigned int m_PreviousPacketID = 0;
World* m_World;
int m_PlayerID = -1;
glm::vec2 m_PlayerPositions[MAXCONNECTIONS];
@@ -7,6 +7,7 @@
#define BOARDSIZE 16
#define MAXCONNECTIONS 8
#define INPUTSIZE 128
#define PACKETMODULUS 1000 // How many packets before the number resets
typedef boost::shared_ptr<boost::asio::ip::udp::socket> socket_ptr;
typedef boost::shared_ptr<std::string> string_ptr;
+5
View File
@@ -32,6 +32,11 @@ private:
std::clock_t m_StopTimes[8];
// Game logic
World* m_World;
// Packet loss logic
unsigned int m_PacketCounter = 0;
unsigned int m_PacketID = 0;
const unsigned int m_PacketModolus = 1000;
// Close logic
bool m_ThreadIsRunning = true;
// Threaded