IPacket interface defines the essential methods for creating and managing network packets. It serves as a blueprint for packet implementations, facilitating communication between the server and clients in a networked environment.

The IPacket interface is fundamental for ensuring standardized communication across the networked game environment, enabling easy creation, validation, and transmission of data packets.

class IPacket {
        using Message = std::vector<uint8_t>;
        using Arguments = std::vector<uint8_t>;

      public:
        virtual ~IPacket() = default;

        
        virtual bool isValid() const = 0;
  
        virtual uint8_t getOpcode() const = 0;
       
        virtual Arguments getArguments() const = 0;

       
        virtual Message toMessage() const = 0;

      protected:

using Message = std::vector<uint8_t>;

Represents the complete message of the packet, which includes the operation code and any associated arguments.

using Arguments = std::vector<uint8_t>;

Represents the arguments contained within the packet, stored as a vector of bytes.

Virtual Methods