declare packets + commands
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
#include <td/Types.h>
|
||||
#include <vector>
|
||||
#include <td/protocol/command/Commands.h>
|
||||
|
||||
// Make it dynamic ?
|
||||
#define LOCKSTEP_BUFFER_SIZE 10
|
||||
|
||||
namespace td {
|
||||
namespace protocol {
|
||||
@@ -11,64 +15,60 @@ struct PlayerInfo {
|
||||
std::string m_PlayerName;
|
||||
};
|
||||
|
||||
struct MapData {
|
||||
|
||||
};
|
||||
|
||||
namespace pdata {
|
||||
|
||||
/** Client attempts to login (very basic) */
|
||||
struct PlayerLogin {
|
||||
std::string m_PlayerName;
|
||||
};
|
||||
|
||||
struct UpdateHealth {
|
||||
float m_NewHealth;
|
||||
};
|
||||
|
||||
/** Server indicates success */
|
||||
struct LoggingSuccess {
|
||||
PlayerID m_PlayerId;
|
||||
};
|
||||
|
||||
struct PlayerDeath {};
|
||||
|
||||
/** Player joins the lobby */
|
||||
struct PlayerJoin {
|
||||
PlayerInfo m_Player;
|
||||
};
|
||||
|
||||
/** Player leaves the lobby */
|
||||
struct PlayerLeave {
|
||||
PlayerID m_PlayerId;
|
||||
};
|
||||
|
||||
struct PlayerStats {};
|
||||
|
||||
struct PlayerList {
|
||||
std::vector<PlayerInfo> m_Players;
|
||||
};
|
||||
|
||||
struct ServerConfig {};
|
||||
|
||||
struct ServerTps {};
|
||||
|
||||
struct UpdateGameState {};
|
||||
|
||||
/** Keep alive */
|
||||
struct KeepAlive {
|
||||
std::uint64_t m_KeepAliveId;
|
||||
};
|
||||
|
||||
struct Disconnect {};
|
||||
/** Can be used by both client and server */
|
||||
struct Disconnect {
|
||||
std::string m_Reason;
|
||||
};
|
||||
|
||||
/** Chat message */
|
||||
struct ChatMessage {
|
||||
std::string m_Text;
|
||||
};
|
||||
|
||||
struct PlayerPositionAndRotation {
|
||||
PlayerID m_Player;
|
||||
// godot::Vector3 m_Position;
|
||||
// godot::Vector3 m_Rotation;
|
||||
// godot::Vector3 m_Velocity;
|
||||
// TODO: handle players joining in the first second
|
||||
|
||||
struct BeginGame {
|
||||
MapData m_Map;
|
||||
std::vector<PlayerInfo> m_BlueTeam;
|
||||
std::vector<PlayerInfo> m_RedTeam;
|
||||
// optional, used for players joining mid game
|
||||
std::vector<LockStep> m_FirstLocksteps;
|
||||
};
|
||||
|
||||
struct PlayerShoot {
|
||||
PlayerID m_Sender;
|
||||
// godot::Vector3 m_Position;
|
||||
// godot::Vector3 m_Rotation;
|
||||
// godot::Vector3 m_Velocity;
|
||||
struct LockSteps {
|
||||
std::uint16_t m_FirstFrameNumber;
|
||||
std::array<LockStep, LOCKSTEP_BUFFER_SIZE> m_LockSteps;
|
||||
};
|
||||
|
||||
} // namespace pdata
|
||||
|
||||
Reference in New Issue
Block a user