Implemented new version of snapshot for 3D world. Also some cleanup.

This commit is contained in:
stiffly
2015-12-08 17:57:01 +01:00
parent d1880754f5
commit 9f54a08536
5 changed files with 52 additions and 112 deletions
+7 -7
View File
@@ -11,7 +11,9 @@
#include "Network/MessageType.h"
#include "Network/NetworkDefines.h"
#include "Network/PlayerDefinition.h"
#include "Network/WinLeakCheck.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Core/EKeyDown.h"
@@ -21,14 +23,12 @@ class Client
public:
Client();
~Client();
void Start(EventBroker* eventBroker);
void Start(World* world, EventBroker* eventBroker);
void Close();
private:
// Threaded
void DisplayLoop();
void ReadFromServer();
void InputLoop();
int Receive(char* data, size_t length);
int CreateMessage(MessageType type, std::string message, char* data);
@@ -41,19 +41,19 @@ private:
void ParsePing();
void ParseServerPing();
void ParseSnapshot(char* data, size_t length);
//void SendInput();
void SendDebugInput();
void DrawBoard();
void CreateNewPlayer(int i);
// udp stuff
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
boost::asio::io_service m_IOService;
boost::asio::ip::udp::socket m_Socket;
World* m_World;
int m_PlayerID = -1;
char m_GameBoard[BOARDSIZE][BOARDSIZE];
glm::vec2 m_PlayerPositions[MAXCONNECTIONS];
std::string m_PlayerNames[MAXCONNECTIONS];
//std::string m_PlayerNames[MAXCONNECTIONS];
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
std::clock_t m_StartPingTime;
double m_DurationOfPingTime;
bool m_ShouldDrawGameBoard = true;
+2 -2
View File
@@ -3,8 +3,8 @@
#include <string>
struct PlayerDefinition {
unsigned int EntityID;
std::string Name;
unsigned int EntityID = -1;
std::string Name = "";
boost::asio::ip::udp::endpoint Endpoint;
};