Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
Packet.hpp File Reference

Network packet implementation for R-Type protocol. More...

#include "RType/ECS/ComponentConcept.hpp"
#include "RType/Math/Vec2.hpp"
#include <bit>
#include <cstdint>
#include <cstring>
#include <span>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <asio/buffer.hpp>
#include <array>
#include <type_traits>
#include "Packet.tpp"
Include dependency graph for Packet.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

namespace  rtp::net
 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.
 
namespace  rtp
 

Typedefs

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

Enumerations

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

Variables

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

Detailed Description

Network packet implementation for R-Type protocol.

Definition in file Packet.hpp.