#pragma once
#include
#include
#include |
#include |
#include |
// Make it dynamic ?
#define LOCKSTEP_BUFFER_SIZE 10
namespace td {
namespace protocol {
struct PlayerInfo {
PlayerID m_PlayerId;
std::string m_PlayerName;
};
struct MapData {
};
namespace pdata {
/** Client attempts to login (very basic) */
struct PlayerLogin {
std::string m_PlayerName;
};
/** Server indicates success */
struct LoggingSuccess {
PlayerID m_PlayerId;
};
/** Player joins the lobby */
struct PlayerJoin {
PlayerInfo m_Player;
};
/** Player leaves the lobby */
struct PlayerLeave {
PlayerID m_PlayerId;
};
struct PredictCommand {
CommandPtr m_Command;
std::uint16_t m_FrameNumber;
};
/** Keep alive */
struct KeepAlive {
std::uint64_t m_KeepAliveId;
};
/** Can be used by both client and server */
struct Disconnect {
std::string m_Reason;
};
/** Chat message */
struct ChatMessage {
std::string m_Text;
};
// TODO: handle players joining in the first second
struct BeginGame {
std::vector m_BlueTeam;
std::vector m_RedTeam;
// optional, used for players joining mid game
std::vector m_FirstLocksteps;
};
struct LockSteps {
std::uint16_t m_FirstFrameNumber;
std::array m_LockSteps;
};
struct WorldHeader {
game::TowerTileColorPalette m_TowerPlacePalette;
Color m_WalkablePalette;
std::vector m_DecorationPalette;
Color m_Background;
game::SpawnColorPalette m_SpawnColorPalette;
game::TilePalette m_TilePalette;
game::Spawn m_RedSpawn, m_BlueSpawn;
game::TeamCastle m_RedCastle, m_BlueCastle;
};
struct WorldData {
game::ChunkList m_Chunks;
};
struct SpawnTroop {
sp::BitField m_Type;
sp::BitField m_Level;
};
struct PlaceTower {
TowerType m_Type;
TowerCoords m_Position;
};
} // namespace pdata
} // namespace protocol
} // namespace td
| |