working on the server's skeleton, still slow going

This commit is contained in:
Kayne Ruse
2013-06-10 17:23:26 +10:00
parent 0a48131de4
commit c21a95f3e9
7 changed files with 155 additions and 19 deletions
+4
View File
@@ -1,4 +1,8 @@
#ifndef DEFINES_HPP_
#define DEFINES_HPP
#include <chrono>
typedef std::chrono::high_resolution_clock Clock;
#endif
+12 -13
View File
@@ -23,66 +23,65 @@ enum class PacketType {
PLAYER_NEW = 9,
PLAYER_DELETE = 10,
PLAYER_MOVE = 11,
};
struct Ping {
PacketType type = PacketType::PING;
PacketType type;
};
struct Pong {
PacketType type = PacketType::PONG;
PacketType type;
};
struct BroadcastRequest {
PacketType type = PacketType::BROADCAST_REQUEST;
PacketType type;
};
struct BroadcastResponse {
PacketType type = PacketType::BROADCAST_RESPONSE;
PacketType type;
char name[PACKET_STRING_SIZE];
//TODO: version
};
struct JoinRequest {
PacketType type = PacketType::JOIN_REQUEST;
PacketType type;
//TODO: player data
};
struct JoinResponse {
PacketType type = PacketType::JOIN_RESPONSE;
PacketType type;
int playerIndex;
//resource list
};
struct Disconnect {
PacketType type = PacketType::DISCONNECT;
PacketType type;
};
struct Synchronize {
PacketType type = PacketType::SYNCHRONIZE;
PacketType type;
};
struct PlayerNew {
PacketType type = PacketType::PLAYER_NEW;
PacketType type;
int playerIndex;
//TODO Playerdata
};
struct PlayerDelete {
PacketType type = PacketType::PLAYER_DELETE;
PacketType type;
int playerIndex;
};
struct PlayerMove {
PacketType type = PacketType::PLAYER_MOVE;
PacketType type;
int playerIndex;
Vector2 position;
Vector2 motion;
};
union Packet {
Packet() {}
Packet() {};
PacketType type = PacketType::NONE;
Ping ping;