Redid timers.

This commit is contained in:
Jocke
2016-03-12 21:38:46 +01:00
parent f8f536802f
commit b7d88808e2
4 changed files with 32 additions and 27 deletions
+6 -6
View File
@@ -77,10 +77,10 @@ private:
// Network logic
PlayerDefinition m_PlayerDefinitions[8];
SnapshotDefinitions m_NextSnapshot;
double m_DurationOfPingTime;
std::clock_t m_StartPingTime;
std::clock_t m_TimeSinceSentInputs;
unsigned int m_SendInputIntervalMs;
double m_DurationOfPingTime = 0;
double m_StartPingTime = 0;
double m_TimeSinceSentInputs = 0;
double m_SendInputInterval = 0.033;
std::vector<Events::InputCommand> m_InputCommandBuffer;
// Private member functions
@@ -141,8 +141,8 @@ private:
UDPClient m_ServerlistRequest;
std::vector<ServerInfo> m_Serverlist;
bool m_SearchingForServers = false;
std::clock_t m_StartSearchTime;
double m_SearchingTime = 200; // Config I guess
double m_TimeSearched = 0;
double m_SearchingTime = 0.2; // Config I guess
};
#endif
+7 -7
View File
@@ -52,14 +52,14 @@ private:
char readBuffer[BUFFERSIZE] = { 0 };
size_t bytesRead = 0;
// time for previouse message
std::clock_t previousePingMessage = std::clock();
std::clock_t previousSnapshotMessage = std::clock();
std::clock_t timOutTimer = std::clock();
double previousePingMessage = 0;
double previousSnapshotMessage = 0;
double timOutTimer = 0;
// How often we send messages (milliseconds)
float pingIntervalMs;
float snapshotInterval;
int checkTimeOutInterval = 100;
// How often we send messages (seconds)
double pingInterval = 1;
double snapshotInterval = 0.05;
double checkTimeOutInterval = 0.1;
int m_NextPlayerID = 0;
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
//Timers