Skip to content
Denis edited this page Sep 11, 2021 · 6 revisions
enum PR_EventType
{
    PR_INCOMING_PACKET,
    PR_INCOMING_RPC,
    PR_OUTGOING_PACKET,
    PR_OUTGOING_RPC,
    PR_INCOMING_RAW_PACKET,
    PR_INCOMING_INTERNAL_PACKET,
    PR_OUTGOING_INTERNAL_PACKET,
    PR_INCOMING_CUSTOM_RPC,

    PR_NUMBER_OF_EVENT_TYPES,

    // backward compatibility
    PR_OUTCOMING_PACKET = PR_OUTGOING_PACKET,
    PR_OUTCOMING_RPC = PR_OUTGOING_RPC,
};

enum PR_ValueType
{
    PR_INT8, // char
    PR_INT16, // short
    PR_INT32, // int
    PR_UINT8, // unsigned char
    PR_UINT16, // unsigned short
    PR_UINT32, // unsigned int
    PR_FLOAT, // float
    PR_BOOL, // bool
    PR_STRING, // char[]

    // compressed types. For non-floating point, this is lossless, but only has benefit if you use less than half the range of the type
    PR_CINT8,
    PR_CINT16,
    PR_CINT32,
    PR_CUINT8,
    PR_CUINT16,
    PR_CUINT32,
    PR_CFLOAT, // read/write a float using 2 bytes instead of 4. Lossy. The range must be between -1 and +1
    PR_CBOOL,
    PR_CSTRING,

    PR_BITS,
    PR_FLOAT3, // float * 3
    PR_FLOAT4, // float * 4
    PR_VECTOR, // read/write a float vector, using 10 bytes instead of 12. Loses accuracy to about 3/10ths and only saves 2 bytes, so only use if accuracy is not important
    PR_NORM_QUAT, // read/write a normalized float quaternion in 6 bytes + 4 bits instead of 16 bytes. Slightly lossy

    PR_STRING8, // unsigned char + char[]
    PR_STRING32, // unsigned int + char[]

    PR_IGNORE_BITS, // shift read/write pointer
};

enum PR_PacketPriority
{
    PR_SYSTEM_PRIORITY, // used by RakNet to send above-high priority messages
    PR_HIGH_PRIORITY, // high priority messages are send before medium priority messages
    PR_MEDIUM_PRIORITY, // medium priority messages are send before low priority messages
    PR_LOW_PRIORITY, // low priority messages are only sent when no other messages are waiting
};

enum PR_PacketReliability
{
    PR_UNRELIABLE = 6, // same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length
    PR_UNRELIABLE_SEQUENCED, // regular UDP with a sequence counter. Out of order messages will be discarded. This adds an additional 13 bits on top what is used for UNRELIABLE
    PR_RELIABLE, // the message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE
    PR_RELIABLE_ORDERED, // this message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED
    PR_RELIABLE_SEQUENCED, // this message is reliable and will arrive in the sequence you sent it. Out or order messages will be dropped. Same overhead as UNRELIABLE_SEQUENCED
};