Skip to content

Header Size

Ittipon Teerapruettikulchai edited this page Jul 6, 2018 · 4 revisions

Every message sent between server and clients, have header start with msgType (short) then following with messages data

Size of data

  • byte = 8 bits
  • short = 2 bytes
  • int = 4 bytes
  • long = 8 bytes

** I've packed uint so it can have packet size from 2-4 bytes, ulong too it can have packet size from 2-8 bytes **

Client net function calls

Client net function calls header size will equal to:

msgType (short) + receivers (byte) + objectId (uint) + behaviourIndex (byte) +elementId (byte)

Or if receivers is Target

msgType (short) + receivers (byte) + connectId (long) + objectId (uint) + behaviourIndex (byte) +elementId (byte)

Then following with function's parameters sizes

Server spawn scene object

Server spawn scene object message size will equal to:

msgType (short) + objectId (uint) + position (3*float) + rotation (3*float)

Server spawn object

Server spawn object message size will equal to:

msgType (short) + assetId (string) + objectId (uint) + connectId (long) + position (3*float) + rotation (3*float)

Server destroy object

Server destroy object message size will equal to:

msgType (short) + objectId (uint) + reasons (byte)

Server update sync field

Server update sync field header size will equal to:

msgType (short) + objectId (uint) + behaviourIndex (byte) + elementId (byte) Then following with field size

Server net function calls

Server net function calls header size will equals to:

msgType (short) + objectId (uint) + behaviourIndex (byte) + elementId (byte) Then following with function's parameters sizes

Server update sync list

Server update sync list header size will equal to:

msgType (short) + objectId (uint) + behaviourIndex (byte) + elementId (byte) + operation (byte) Then...

if operation is Add it will following with field size

if operation is Insert it will following with index (int) and field size

if operation is Set it will following with index (int) and field size

if operation is Dirty it will following with index (int) and field size

if operation is RemoveAt it will following with index (int)