Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::net Namespace Reference

File : IEventPublisher.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias.nosp@m.-jos.nosp@m.ue.ha.nosp@m.jjar.nosp@m.-llau.nosp@m.quen.nosp@m.@epit.nosp@m.ech..nosp@m.eu Date : 11/12/2025. More...

Classes

struct  AmmoUpdatePayload
 Ammo update notification data Server OpCode. More...
 
struct  BeamStatePayload
 Notify clients that an entity's beam started or stopped. More...
 
struct  BooleanPayload
 Generic boolean response payload. More...
 
struct  ConnectPayload
 Player connection data sended Client OpCode. More...
 
struct  CreateRoomPayload
 Data for creating a new room Client OpCode. More...
 
struct  DebugModePayload
 Debug mode toggle data Server OpCode. More...
 
struct  EntityDeathPayload
 Entity death notification data. More...
 
struct  EntitySnapshotPayload
 Entity state snapshot data. More...
 
struct  EntitySpawnPayload
 Entity spawn notification data. More...
 
struct  GameOverPayload
 Game over summary data. More...
 
struct  Header
 Packet header with sequencing and acknowledgment support. More...
 
struct  HealthUpdatePayload
 Player health update data. More...
 
class  IEventPublisher
 Interface for network event handling. More...
 
class  INetwork
 Interface for network operations. More...
 
struct  InputPayload
 Client input state data. More...
 
struct  JoinRoomPayload
 Data for joining an existing room Client OpCode. More...
 
struct  LoginPayload
 
struct  LoginResponsePayload
 Login response data sent by server for LoginResponse Server OpCode. More...
 
struct  NetworkEvent
 Represents a network event containing session ID and packet data. More...
 
class  Packet
 Network packet with header and serializable body. More...
 
struct  PingPayload
 Ping request/response payload Client/Server /Pong OpCodes. More...
 
struct  RegisterPayload
 Player registration data sended by client Client OpCode. More...
 
struct  RegisterResponsePayload
 Registration response data sent by server for RegisterResponse Server OpCode. More...
 
struct  RoomChatPayload
 Data for sending chat messages in a room Client OpCode. More...
 
struct  RoomChatReceivedPayload
 Data for receiving chat messages in a room Server OpCode. More...
 
struct  RoomInfo
 Information about a game room Server OpCode. More...
 
struct  RoomSnapshotPayload
 
struct  ScoreUpdatePayload
 Player score update notification data. More...
 
class  Session
 
struct  SetReadyPayload
 Data for setting player readiness status Client OpCode. More...
 

Typedefs

using BufferSequence = std::array< asio::const_buffer, 2 >
 @using BufferSequence
 

Enumerations

enum class  NetworkMode { TCP , UDP }
 Enum representing network transmission modes. More...
 
enum class  OpCode : uint8_t {
  None = 0x00 , Hello = 0x01 , Welcome = 0x02 , Disconnect = 0x03 ,
  LoginRequest = 0x1A , RegisterRequest = 0x1B , LoginResponse = 0x9A , RegisterResponse = 0x9B ,
  ListRooms = 0x04 , RoomList = 0x05 , CreateRoom = 0x06 , JoinRoom = 0x07 ,
  LeaveRoom = 0x08 , RoomUpdate = 0x09 , SetReady = 0x0A , RoomChatSended = 0x0B ,
  RoomChatReceived = 0x0C , StartGame = 0x0D , InputTick = 0x10 , UpdateSelectedWeapon = 0x11 ,
  EntitySpawn = 0x21 , EntityDeath = 0x22 , AmmoUpdate = 0x23 , Ping = 0x24 ,
  Pong = 0x25 , DebugModeUpdate = 0x26 , Kicked = 0x27 , BeamState = 0x28 ,
  ScoreUpdate = 0x29 , GameOver = 0x2A , HealthUpdate = 0x2B
}
 Operation codes for different packet types. More...
 
enum class  EntityType : uint8_t {
  Player = 1 , Scout = 2 , Tank = 3 , Boss = 4 ,
  Bullet = 5 , PowerupHeal = 6 , PowerupSpeed = 7 , Obstacle = 8 ,
  EnemyBullet = 9 , ObstacleSolid = 10 , ChargedBullet = 11 , PowerupDoubleFire = 12 ,
  PowerupShield = 13 , BossShield = 14 , Boss2 = 15 , Boss2Bullet = 16
}
 Types of entities in the game. More...
 
enum class  roomType : uint8_t { Lobby = 0 , Public = 1 , Private = 2 }
 

Variables

constexpr std::endian NATIVE_ENDIAN = std::endian::native
 Native endianness of the machine.
 
constexpr uint16_t MAGIC_NUMBER = 0xA1B2
 Magic number for packet validation.
 
constexpr size_t MTU_SIZE = 1400
 Safe UDP payload size to avoid fragmentation.
 
constexpr uint32_t MAX_STRING_SIZE = 2048
 Maximum sizes for strings, vectors, and packet bodies.
 
constexpr uint32_t MAX_VECTOR_SIZE = 8192
 Maximum size for serialized vectors.
 
constexpr uint32_t MAX_BODY_SIZE = 64 * 1024
 Maximum size for packet body.
 

Detailed Description

File : IEventPublisher.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias.nosp@m.-jos.nosp@m.ue.ha.nosp@m.jjar.nosp@m.-llau.nosp@m.quen.nosp@m.@epit.nosp@m.ech..nosp@m.eu Date : 11/12/2025.

File : NetworkId.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias.nosp@m.-jos.nosp@m.ue.ha.nosp@m.jjar.nosp@m.-llau.nosp@m.quen.nosp@m.@epit.nosp@m.ech..nosp@m.eu Date : 11/12/2025.

Network layer for R-Type protocol.

File : INetwork.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias.nosp@m.-jos.nosp@m.ue.ha.nosp@m.jjar.nosp@m.-llau.nosp@m.quen.nosp@m.@epit.nosp@m.ech..nosp@m.eu Date : 11/12/2025.

Network layer for R-Type protocol

Typedef Documentation

◆ BufferSequence

using rtp::net::BufferSequence = typedef std::array<asio::const_buffer, 2>

@using BufferSequence

Buffer sequence for efficient multi-part network transmission

Represents a sequence of constant buffers (header and body) that can be sent atomically to avoid multiple system calls. Allows ASIO to gather and send packet header and body in a single operation.

Definition at line 454 of file Packet.hpp.

Enumeration Type Documentation

◆ EntityType

enum class rtp::net::EntityType : uint8_t
strong

Types of entities in the game.

Enumerator
Player 
Scout 
Tank 
Boss 
Bullet 
PowerupHeal 
PowerupSpeed 
Obstacle 
EnemyBullet 
ObstacleSolid 
ChargedBullet 
PowerupDoubleFire 
PowerupShield 
BossShield 
Boss2 
Boss2Bullet 

Definition at line 144 of file Packet.hpp.

◆ NetworkMode

enum class rtp::net::NetworkMode
strong

Enum representing network transmission modes.

Note
TCP will be used for reliable data, UDP for real-time data
Enumerator
TCP 
UDP 

Definition at line 25 of file INetwork.hpp.

◆ OpCode

enum class rtp::net::OpCode : uint8_t
strong

Operation codes for different packet types.

Enumerator
None 

No operation.

Hello 

Client hello packet.

Welcome 

Server welcome response.

Disconnect 

Disconnect notification.

LoginRequest 

Client login request.

RegisterRequest 

Server login response.

LoginResponse 

Successful connection notification.

RegisterResponse 

Incorrect password notification.

ListRooms 

Request for room list.

RoomList 

Response with room list.

CreateRoom 

Request to create a room.

JoinRoom 

Request to join a room.

LeaveRoom 

Request to leave a room.

RoomUpdate 

Notification of room update.

SetReady 

Set player readiness status.

RoomChatSended 

Chat message in room.

RoomChatReceived 

Chat message received in room.

StartGame 

Notification to start the game.

InputTick 

Client input state.

UpdateSelectedWeapon 

Client selected weapon changed.

EntitySpawn 

Entity spawn notification.

EntityDeath 

Entity death notification.

AmmoUpdate 

Ammo update notification.

Ping 

Ping request.

Pong 

Ping response.

DebugModeUpdate 

Debug mode toggle.

Kicked 

Player kicked notification.

BeamState 

Beam start/stop notification.

ScoreUpdate 

Player score update.

GameOver 

Game over summary.

HealthUpdate 

Player health update.

Definition at line 78 of file Packet.hpp.

◆ roomType

enum class rtp::net::roomType : uint8_t
strong
Enumerator
Lobby 

Lobby room (system)

Public 

Public room.

Private 

Private room.

Definition at line 233 of file Packet.hpp.

Variable Documentation

◆ MAGIC_NUMBER

constexpr uint16_t rtp::net::MAGIC_NUMBER = 0xA1B2
constexpr

◆ MAX_BODY_SIZE

constexpr uint32_t rtp::net::MAX_BODY_SIZE = 64 * 1024
constexpr

Maximum size for packet body.

Definition at line 72 of file Packet.hpp.

◆ MAX_STRING_SIZE

constexpr uint32_t rtp::net::MAX_STRING_SIZE = 2048
constexpr

Maximum sizes for strings, vectors, and packet bodies.

Definition at line 62 of file Packet.hpp.

◆ MAX_VECTOR_SIZE

constexpr uint32_t rtp::net::MAX_VECTOR_SIZE = 8192
constexpr

Maximum size for serialized vectors.

Definition at line 67 of file Packet.hpp.

◆ MTU_SIZE

constexpr size_t rtp::net::MTU_SIZE = 1400
constexpr

Safe UDP payload size to avoid fragmentation.

Definition at line 57 of file Packet.hpp.

◆ NATIVE_ENDIAN

constexpr std::endian rtp::net::NATIVE_ENDIAN = std::endian::native
constexpr

Native endianness of the machine.

Definition at line 47 of file Packet.hpp.

Referenced by rtp::net::Packet::to_network().