r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
AsioClient.hpp
Go to the documentation of this file.
1///
2/// @file AsioClient.hpp
3/// @brief Asio-based UDP client implementation for R-Type multiplayer game networking
4/// @details This file provides a complete UDP client implementation using ASIO library.
5/// It handles server connection, packet transmission/reception, lobby management,
6/// and game state synchronization. The client implements the R-Type Network Protocol (RNP).
7/// @namespace eng
8/// @author R-Type Team
9/// @date 2025
10///
11
12#pragma once
13
17#include "Utils/Event.hpp"
18#include "Utils/EventBus.hpp"
19
20#include <asio.hpp>
21#include <atomic>
22#include <chrono>
23#include <memory>
24#include <mutex>
25#include <queue>
26#include <string>
27#include <thread>
28#include <vector>
29
30namespace eng
31{
32
33 ///
34 /// @struct QueuedPacket
35 /// @brief Represents a packet queued for asynchronous transmission to server
36 /// @details Used in the send queue to buffer outgoing packets before transmission
37 ///
39 {
40 std::vector<std::uint8_t> data; ///< Serialized packet data
41 bool reliable; ///< Whether packet requires reliable delivery
42
43 ///
44 /// @brief Constructor
45 /// @param d Packet data buffer
46 /// @param rel Reliability flag (default: false)
47 ///
48 explicit QueuedPacket(const std::vector<std::uint8_t> &d, const bool rel = false) : data(d), reliable(rel)
49 {
50 }
51 };
52
53 ///
54 /// @struct ConnectionStats
55 /// @brief Connection statistics tracking
56 /// @details Tracks various network metrics for monitoring and debugging
57 ///
59 {
60 std::uint32_t packetsSent = 0; ///< Total number of packets sent
61 std::uint32_t packetsReceived = 0; ///< Total number of packets received
62 std::uint32_t bytesTransferred = 0; ///< Total bytes transferred (sent + received)
63 std::uint32_t packetsLost = 0; ///< Estimated number of lost packets
64 std::chrono::steady_clock::time_point connectionTime; ///< Timestamp when connection was established
65 };
66
67 ///
68 /// @class AsioClient
69 /// @brief High-performance UDP client implementation using ASIO library
70 /// @details This class provides a complete multiplayer game client implementation with:
71 /// - Asynchronous UDP networking
72 /// - Server connection management
73 /// - Lobby system integration
74 /// - Packet routing and handling
75 /// - Event bus integration
76 /// - Thread-safe operations
77 /// - Latency measurement
78 ///
79 /// The client runs its network operations on a separate thread and communicates
80 /// with the game engine via an event bus system.
81 ///
82 /// @namespace eng
83 ///
84 class AsioClient final : public INetworkClient
85 {
86 public:
87 ///
88 /// @brief Constructor
89 ///
90 AsioClient();
91
92 ///
93 /// @brief Destructor
94 ///
95 ~AsioClient() override;
96
97 ///
98 /// @brief Connect to game server
99 /// @param host Server hostname or IP address
100 /// @param port Server port number
101 ///
102 void connect(const std::string &host, std::uint16_t port) override;
103
104 ///
105 /// @brief Disconnect from server
106 /// @details Sends DISCONNECT packet and closes connection
107 ///
108 void disconnect() override;
109
110 ///
111 /// @brief Update client state (called each frame)
112 /// @details Processes send queue, checks timeouts, sends pings
113 ///
114 void update() override;
115
116 [[nodiscard]] const std::string getName() const override { return "Network_Client"; }
117 [[nodiscard]] utl::PluginType getType() const override { return utl::PluginType::NETWORK_CLIENT; }
118
119 ///
120 /// @brief Check if client is connected to server
121 /// @return True if connected
122 ///
123 [[nodiscard]] bool isConnected() const override;
124
125 ///
126 /// @brief Get current connection state
127 /// @return Connection state enum
128 ///
129 [[nodiscard]] ConnectionState getConnectionState() const override;
130
131 ///
132 /// @brief Get assigned session ID
133 /// @return Session ID (0 if not connected)
134 ///
135 [[nodiscard]] std::uint32_t getSessionId() const override;
136
137 ///
138 /// @brief Get server tick rate
139 /// @return Server tick rate in Hz
140 ///
141 [[nodiscard]] std::uint16_t getServerTickRate() const override;
142
143 ///
144 /// @brief Get current latency to server
145 /// @return Round-trip time in milliseconds
146 ///
147 [[nodiscard]] std::uint32_t getLatency() const override;
148
149 ///
150 /// @brief Set player name for connection
151 /// @param playerName Display name
152 ///
153 void setPlayerName(const std::string &playerName) override;
154
155 ///
156 /// @brief Set client capability flags
157 /// @param caps Capability flags (reserved)
158 ///
159 void setClientCapabilities(std::uint32_t caps) override;
160
161 ///
162 /// @brief Process events from event bus
163 /// @details Handles events from game engine
164 ///
165 void processBusEvent();
166
167 ///
168 /// @brief Send custom packet to server
169 /// @param data Serialized packet data
170 /// @param reliable Whether packet requires reliable delivery (default: false)
171 ///
172 void sendToServer(const std::vector<std::uint8_t> &data, bool reliable = false) override;
173
174 ///
175 /// @brief Get connection statistics
176 /// @return Current connection stats
177 ///
178 const ConnectionStats &getStats() const { return m_stats; }
179
180 // Lobby management methods
181 ///
182 /// @brief Request list of available lobbies from server
183 /// @details Sends LOBBY_LIST_REQUEST packet
184 ///
185 void requestLobbyList();
186
187 ///
188 /// @brief Create a new lobby on server
189 /// @param lobbyCreate Lobby creation parameters (name, max players, game mode)
190 /// @details Sends LOBBY_CREATE packet. Response handled via callback.
191 ///
192 void createLobby(rnp::PacketLobbyCreate lobbyCreate);
193
194 ///
195 /// @brief Join an existing lobby
196 /// @param lobbyId Target lobby identifier
197 /// @details Sends LOBBY_JOIN packet. Response handled via callback.
198 ///
199 void joinLobby(std::uint32_t lobbyId);
200
201 ///
202 /// @brief Leave current lobby
203 /// @details Sends LOBBY_LEAVE packet and resets local lobby state
204 ///
205 void leaveLobby();
206
207 ///
208 /// @brief Request to start the game (host only)
209 /// @param lobbyId Lobby ID to start
210 /// @details Sends START_GAME_REQUEST packet. Only valid for lobby host.
211 ///
212 void requestStartGame(std::uint32_t lobbyId);
213
214 ///
215 /// @brief Get current lobby ID
216 /// @return Current lobby ID (0 if not in lobby)
217 ///
218 std::uint32_t getCurrentLobbyId() const { return m_currentLobbyId; }
219
220 ///
221 /// @brief Check if player is in a lobby
222 /// @return True if in lobby
223 ///
224 bool isInLobby() const { return m_currentLobbyId != 0; }
225
226 // Callback setters for lobby events
227 ///
228 /// @brief Set callback for lobby list received
229 /// @param callback Function(vector<LobbyInfo>) called when LOBBY_LIST_RESPONSE is received
230 ///
231 void setOnLobbyListReceived(std::function<void(const std::vector<rnp::LobbyInfo> &)> callback);
232
233 ///
234 /// @brief Set callback for lobby creation response
235 /// @param callback Function(lobbyId, success, errorCode) called when LOBBY_CREATE_RESPONSE is received
236 ///
237 void setOnLobbyCreated(std::function<void(std::uint32_t, bool, rnp::ErrorCode)> callback);
238
239 ///
240 /// @brief Set callback for lobby join response
241 /// @param callback Function(lobbyId, success, errorCode, lobbyInfo*) called when LOBBY_JOIN_RESPONSE is
242 /// received
243 ///
244 void
245 setOnLobbyJoined(std::function<void(std::uint32_t, bool, rnp::ErrorCode, const rnp::LobbyInfo *)> callback);
246
247 ///
248 /// @brief Set callback for lobby updates
249 /// @param callback Function(LobbyInfo) called when LOBBY_UPDATE is received (player join/leave, status
250 /// change)
251 ///
252 void setOnLobbyUpdated(std::function<void(const rnp::LobbyInfo &)> callback);
253
254 ///
255 /// @brief Set callback for game start notification
256 /// @param callback Function(lobbyId, sessionId) called when GAME_START is received
257 ///
258 void setOnGameStart(std::function<void(std::uint32_t, std::uint32_t)> callback);
259
260 private:
261 // Network components
262 std::unique_ptr<asio::io_context> m_ioContext; ///< ASIO I/O context for async operations
263 std::unique_ptr<asio::ip::udp::socket> m_socket; ///< UDP socket for network communication
264 std::unique_ptr<std::thread> m_networkThread; ///< Dedicated network thread
265
266 // Server connection info
267 std::string m_serverHost; ///< Server hostname or IP address
268 std::uint16_t m_serverPort; ///< Server port number
269 asio::ip::udp::endpoint m_serverEndpoint; ///< Resolved server endpoint
270
271 // Connection state
272 std::atomic<ConnectionState> m_connectionState; ///< Current connection state (atomic)
273 std::uint32_t m_sessionId; ///< Assigned session ID from server
274 std::uint16_t m_serverTickRate; ///< Server tick rate in Hz
275 std::uint32_t m_clientCaps; ///< Client capability flags
276
277 // Client configuration
278 std::string m_playerName; ///< Player display name
279
280 // Network state
281 std::atomic<bool> m_running; ///< Network thread running state (atomic)
282
283 // Packet handling
284 std::unique_ptr<rnp::HandlerPacket> m_packetHandler; ///< RNP packet handler instance
285 std::queue<QueuedPacket> m_sendQueue; ///< Queue of packets waiting to be sent
286 std::mutex m_sendQueueMutex; ///< Mutex for send queue access
287
288 // Reception buffer
289 std::array<std::uint8_t, 1024> m_recvBuffer; ///< Buffer for receiving UDP packets
290 asio::ip::udp::endpoint m_senderEndpoint; ///< Endpoint of last packet sender
291
292 // Ping/Latency management
293 std::uint32_t m_lastPingNonce; ///< Nonce of last PING sent
294 std::chrono::steady_clock::time_point m_lastPingTime; ///< Timestamp of last PING
295 std::uint32_t m_latency; ///< Round-trip time in milliseconds
296 std::chrono::milliseconds m_pingInterval; ///< Interval between pings (5000ms)
297
298 // Connection timeout
299 std::chrono::steady_clock::time_point m_lastServerResponse; ///< Timestamp of last server packet
300 std::chrono::milliseconds m_connectionTimeout; ///< Timeout duration (15000ms)
301
302 // Statistics
303 ConnectionStats m_stats; ///< Connection statistics
304
305 // Lobby state
306 std::uint32_t m_currentLobbyId; ///< Current lobby ID, 0 if not in lobby
307
308 // Lobby callbacks
309 std::function<void(const std::vector<rnp::LobbyInfo> &)> m_onLobbyListReceived; ///< Lobby list callback
310 std::function<void(std::uint32_t, bool, rnp::ErrorCode)> m_onLobbyCreated; ///< Lobby created callback
311 std::function<void(std::uint32_t, bool, rnp::ErrorCode, const rnp::LobbyInfo *)>
312 m_onLobbyJoined; ///< Lobby joined callback
313 std::function<void(const rnp::LobbyInfo &)> m_onLobbyUpdated; ///< Lobby updated callback
314 std::function<void(std::uint32_t, std::uint32_t)> m_onGameStart; ///< Game start callback
315
316 utl::EventBus &m_eventBus; ///< Event bus reference
317 std::uint32_t m_componentId = utl::NETWORK_CLIENT; ///< Component ID for event bus
318
319 ///
320 /// @brief Setup packet handlers for all RNP packet types
321 /// @details Registers callback functions for each packet type with the packet handler
322 ///
323 void setupPacketHandlers();
324
325 ///
326 /// @brief Start asynchronous receive operation
327 /// @details Initiates async_receive_from on the UDP socket
328 ///
329 void startReceive();
330
331 ///
332 /// @brief Handle received packet data
333 /// @param bytesReceived Number of bytes received from server
334 /// @details Deserializes and dispatches packet to appropriate handler
335 ///
336 void handleReceive(std::size_t bytesReceived);
337
338 ///
339 /// @brief Main network thread loop
340 /// @details Runs the ASIO io_context and handles network events
341 ///
342 void networkThreadLoop() const;
343
344 ///
345 /// @brief Send packet immediately via UDP socket
346 /// @param data Serialized packet data
347 /// @details Bypasses send queue for immediate transmission
348 ///
349 void sendPacketImmediate(const std::vector<std::uint8_t> &data);
350
351 ///
352 /// @brief Handle CONNECT_ACCEPT packet
353 /// @param packet Connect accept packet
354 /// @param context Packet context
355 /// @return Handler result
356 ///
358 const rnp::PacketContext &context);
359
360 ///
361 /// @brief Handle DISCONNECT packet
362 /// @param packet Disconnect packet
363 /// @param context Packet context
364 /// @return Handler result
365 ///
367
368 ///
369 /// @brief Handle PONG packet
370 /// @param packet Pong packet
371 /// @param context Packet context
372 /// @return Handler result
373 ///
375
376 ///
377 /// @brief Handle PING packet
378 /// @param packet Ping packet
379 /// @param context Packet context
380 /// @return Handler result
381 ///
383
384 ///
385 /// @brief Handle ERROR packet
386 /// @param packet Error packet
387 /// @param context Packet context
388 /// @return Handler result
389 ///
390 static rnp::HandlerResult handleError(const rnp::PacketError &packet, const rnp::PacketContext &context);
391
392 ///
393 /// @brief Handle WORLD_STATE packet
394 /// @param packet World state packet
395 /// @param context Packet context
396 /// @return Handler result
397 ///
399 const rnp::PacketContext &context) const;
400
401 ///
402 /// @brief Handle ENTITY_EVENT packet
403 /// @param events Vector of event records
404 /// @param context Packet context
405 /// @return Handler result
406 ///
407 rnp::HandlerResult handleEntityEvent(const std::vector<rnp::EventRecord> &events,
408 const rnp::PacketContext &context) const;
409
410 ///
411 /// @brief Handle LOBBY_LIST_RESPONSE packet
412 /// @param packet Lobby list response packet
413 /// @param context Packet context
414 /// @return Handler result
415 ///
417 const rnp::PacketContext &context) const;
418
419 ///
420 /// @brief Handle LOBBY_CREATE_RESPONSE packet
421 /// @param packet Lobby create response packet
422 /// @param context Packet context
423 /// @return Handler result
424 ///
426 const rnp::PacketContext &context);
427
428 ///
429 /// @brief Handle LOBBY_JOIN_RESPONSE packet
430 /// @param packet Lobby join response packet
431 /// @param context Packet context
432 /// @return Handler result
433 ///
435 const rnp::PacketContext &context);
436
437 ///
438 /// @brief Handle LOBBY_UPDATE packet
439 /// @param packet Lobby update packet
440 /// @param context Packet context
441 /// @return Handler result
442 ///
444 const rnp::PacketContext &context) const;
445
446 ///
447 /// @brief Handle GAME_START packet
448 /// @param packet Game start packet
449 /// @param context Packet context
450 /// @return Handler result
451 ///
453 const rnp::PacketContext &context) const;
454
455 ///
456 /// @brief Send CONNECT packet to initiate connection
457 /// @details Sends player name and client capabilities
458 ///
459 void sendConnect();
460
461 ///
462 /// @brief Send DISCONNECT packet to terminate connection
463 /// @details Includes disconnect reason code
464 ///
465 void sendDisconnect();
466
467 ///
468 /// @brief Send PING packet for latency measurement
469 /// @details Generates and stores nonce for RTT calculation
470 ///
471 void sendPing();
472
473 ///
474 /// @brief Send PONG response to server PING
475 /// @param nonce Ping nonce to echo back
476 ///
477 void sendPong(std::uint32_t nonce);
478
479 ///
480 /// @brief Process outgoing packet queue
481 /// @details Sends all queued packets via UDP socket
482 ///
483 void processSendQueue();
484
485 ///
486 /// @brief Update connection management state
487 /// @details Checks for timeouts and sends periodic pings
488 ///
490
491 ///
492 /// @brief Generate random ping nonce
493 /// @return New cryptographically random nonce
494 ///
495 static std::uint32_t generatePingNonce();
496 };
497
498} // namespace eng
Thread-safe event bus implementation for inter-component communication.
Event structures and types for event-driven communication.
Network packet handler for RNP protocol.
This file contains the client network interface.
This file contains the network protocol.
High-performance UDP client implementation using ASIO library.
void sendDisconnect()
Send DISCONNECT packet to terminate connection.
std::chrono::milliseconds m_connectionTimeout
Timeout duration (15000ms)
std::string m_serverHost
Server hostname or IP address.
void setupPacketHandlers()
Setup packet handlers for all RNP packet types.
rnp::HandlerResult handleLobbyJoinResponse(const rnp::PacketLobbyJoinResponse &packet, const rnp::PacketContext &context)
Handle LOBBY_JOIN_RESPONSE packet.
void joinLobby(std::uint32_t lobbyId)
Join an existing lobby.
void setPlayerName(const std::string &playerName) override
Set player name for connection.
void sendPacketImmediate(const std::vector< std::uint8_t > &data)
Send packet immediately via UDP socket.
rnp::HandlerResult handlePing(const rnp::PacketPingPong &packet, const rnp::PacketContext &context)
Handle PING packet.
std::uint16_t m_serverTickRate
Server tick rate in Hz.
void setOnLobbyJoined(std::function< void(std::uint32_t, bool, rnp::ErrorCode, const rnp::LobbyInfo *)> callback)
Set callback for lobby join response.
std::unique_ptr< asio::ip::udp::socket > m_socket
UDP socket for network communication.
std::uint32_t getSessionId() const override
Get assigned session ID.
std::uint32_t m_clientCaps
Client capability flags.
std::array< std::uint8_t, 1024 > m_recvBuffer
Buffer for receiving UDP packets.
bool isInLobby() const
Check if player is in a lobby.
std::uint32_t m_sessionId
Assigned session ID from server.
const ConnectionStats & getStats() const
Get connection statistics.
rnp::HandlerResult handleDisconnect(const rnp::PacketDisconnect &packet, const rnp::PacketContext &context)
Handle DISCONNECT packet.
void networkThreadLoop() const
Main network thread loop.
std::uint32_t m_componentId
Component ID for event bus.
void disconnect() override
Disconnect from server.
std::atomic< bool > m_running
Network thread running state (atomic)
std::function< void(std::uint32_t, bool, rnp::ErrorCode, const rnp::LobbyInfo *)> m_onLobbyJoined
Lobby joined callback.
static rnp::HandlerResult handleError(const rnp::PacketError &packet, const rnp::PacketContext &context)
Handle ERROR packet.
rnp::HandlerResult handlePong(const rnp::PacketPingPong &packet, const rnp::PacketContext &context)
Handle PONG packet.
void sendPing()
Send PING packet for latency measurement.
rnp::HandlerResult handleLobbyUpdate(const rnp::PacketLobbyUpdate &packet, const rnp::PacketContext &context) const
Handle LOBBY_UPDATE packet.
std::function< void(std::uint32_t, bool, rnp::ErrorCode)> m_onLobbyCreated
Lobby created callback.
rnp::HandlerResult handleWorldState(const rnp::PacketWorldState &packet, const rnp::PacketContext &context) const
Handle WORLD_STATE packet.
rnp::HandlerResult handleConnectAccept(const rnp::PacketConnectAccept &packet, const rnp::PacketContext &context)
Handle CONNECT_ACCEPT packet.
void processSendQueue()
Process outgoing packet queue.
bool isConnected() const override
Check if client is connected to server.
rnp::HandlerResult handleLobbyCreateResponse(const rnp::PacketLobbyCreateResponse &packet, const rnp::PacketContext &context)
Handle LOBBY_CREATE_RESPONSE packet.
std::uint32_t m_latency
Round-trip time in milliseconds.
asio::ip::udp::endpoint m_senderEndpoint
Endpoint of last packet sender.
std::uint32_t m_currentLobbyId
Current lobby ID, 0 if not in lobby.
void setOnGameStart(std::function< void(std::uint32_t, std::uint32_t)> callback)
Set callback for game start notification.
std::uint16_t getServerTickRate() const override
Get server tick rate.
~AsioClient() override
Destructor.
std::atomic< ConnectionState > m_connectionState
Current connection state (atomic)
void update() override
Update client state (called each frame)
void setOnLobbyCreated(std::function< void(std::uint32_t, bool, rnp::ErrorCode)> callback)
Set callback for lobby creation response.
AsioClient()
Constructor.
void sendPong(std::uint32_t nonce)
Send PONG response to server PING.
void sendToServer(const std::vector< std::uint8_t > &data, bool reliable=false) override
Send custom packet to server.
void leaveLobby()
Leave current lobby.
ConnectionState getConnectionState() const override
Get current connection state.
std::chrono::steady_clock::time_point m_lastServerResponse
Timestamp of last server packet.
void setOnLobbyListReceived(std::function< void(const std::vector< rnp::LobbyInfo > &)> callback)
Set callback for lobby list received.
void requestStartGame(std::uint32_t lobbyId)
Request to start the game (host only)
void sendConnect()
Send CONNECT packet to initiate connection.
std::function< void(std::uint32_t, std::uint32_t)> m_onGameStart
Game start callback.
rnp::HandlerResult handleLobbyListResponse(const rnp::PacketLobbyListResponse &packet, const rnp::PacketContext &context) const
Handle LOBBY_LIST_RESPONSE packet.
const std::string getName() const override
rnp::HandlerResult handleGameStart(const rnp::PacketGameStart &packet, const rnp::PacketContext &context) const
Handle GAME_START packet.
static std::uint32_t generatePingNonce()
Generate random ping nonce.
void requestLobbyList()
Request list of available lobbies from server.
std::chrono::steady_clock::time_point m_lastPingTime
Timestamp of last PING.
std::uint16_t m_serverPort
Server port number.
std::function< void(const rnp::LobbyInfo &)> m_onLobbyUpdated
Lobby updated callback.
void processBusEvent()
Process events from event bus.
std::unique_ptr< std::thread > m_networkThread
Dedicated network thread.
std::unique_ptr< rnp::HandlerPacket > m_packetHandler
RNP packet handler instance.
std::uint32_t m_lastPingNonce
Nonce of last PING sent.
void setOnLobbyUpdated(std::function< void(const rnp::LobbyInfo &)> callback)
Set callback for lobby updates.
std::string m_playerName
Player display name.
std::function< void(const std::vector< rnp::LobbyInfo > &)> m_onLobbyListReceived
Lobby list callback.
void connect(const std::string &host, std::uint16_t port) override
Connect to game server.
asio::ip::udp::endpoint m_serverEndpoint
Resolved server endpoint.
rnp::HandlerResult handleEntityEvent(const std::vector< rnp::EventRecord > &events, const rnp::PacketContext &context) const
Handle ENTITY_EVENT packet.
std::chrono::milliseconds m_pingInterval
Interval between pings (5000ms)
std::queue< QueuedPacket > m_sendQueue
Queue of packets waiting to be sent.
utl::PluginType getType() const override
void handleReceive(std::size_t bytesReceived)
Handle received packet data.
ConnectionStats m_stats
Connection statistics.
void updateConnectionManagement()
Update connection management state.
std::unique_ptr< asio::io_context > m_ioContext
ASIO I/O context for async operations.
void startReceive()
Start asynchronous receive operation.
utl::EventBus & m_eventBus
Event bus reference.
std::uint32_t getCurrentLobbyId() const
Get current lobby ID.
std::mutex m_sendQueueMutex
Mutex for send queue access.
std::uint32_t getLatency() const override
Get current latency to server.
void setClientCapabilities(std::uint32_t caps) override
Set client capability flags.
void createLobby(rnp::PacketLobbyCreate lobbyCreate)
Create a new lobby on server.
Interface for the client network.
Thread-safe event bus for decoupled component communication.
Definition EventBus.hpp:31
ConnectionState
Connection state enumeration.
ErrorCode
Error codes.
Definition Protocol.hpp:75
HandlerResult
Packet processing result.
PluginType
Definition IPlugin.hpp:22
static constexpr std::uint32_t NETWORK_CLIENT
Definition Event.hpp:17
Connection statistics tracking.
std::uint32_t packetsSent
Total number of packets sent.
std::uint32_t packetsReceived
Total number of packets received.
std::chrono::steady_clock::time_point connectionTime
Timestamp when connection was established.
std::uint32_t packetsLost
Estimated number of lost packets.
std::uint32_t bytesTransferred
Total bytes transferred (sent + received)
Represents a packet queued for asynchronous transmission to server.
QueuedPacket(const std::vector< std::uint8_t > &d, const bool rel=false)
Constructor.
std::vector< std::uint8_t > data
Serialized packet data.
bool reliable
Whether packet requires reliable delivery.
Lobby information structure.
Definition Protocol.hpp:237
CONNECT_ACCEPT packet payload.
Definition Protocol.hpp:148
Context information for packet processing.
DISCONNECT packet payload.
Definition Protocol.hpp:159
ERROR packet payload.
Definition Protocol.hpp:217
GAME_START packet payload.
Definition Protocol.hpp:309
LOBBY_CREATE_RESPONSE packet payload.
Definition Protocol.hpp:272
LOBBY_CREATE packet payload.
Definition Protocol.hpp:261
LOBBY_JOIN_RESPONSE packet payload.
Definition Protocol.hpp:290
LOBBY_LIST_RESPONSE packet payload.
Definition Protocol.hpp:252
LOBBY_UPDATE packet payload.
Definition Protocol.hpp:301
PING/PONG packet payload.
Definition Protocol.hpp:208
WORLD_STATE packet payload.
Definition Protocol.hpp:198