Skip navigation.
Home

Binary Entity Stream

jwatte's picture
  1. Master and Slave can both introduce entities
    1. Entity is introduced as a source-unique ID as an instance of a schema class.
    2. The schema class has a resolution mechanism if previously unknown.
    3. Entities can come and go while the session is live.
    4. Use template/value bindings in entity description.
    5. Entity class contains references to where to get resources.
      1. If a large amount of choice is available, perhaps only send data values when requested?
  FRAMING (VERB SIZE DATA)+
  
  FRAMING:
    TOKEN
    SIZE (including verbs)
    SIZE (header size)
    PACKETID
    FLAGS
    GLOBALTIME
    NACKS (PACKETID)+

Integers sent as variable length. 7 bits data, 8th bit means
continuation. Big-endian order. If highest defined bit is set, it's
negative, except for 1-byte case.

Floats are sent as 32-bit or 64-bit IEEE floats, or as fixed format ints
(based on schema). Big-endian order.

Strings are sent as byte count (int as above) + UTF-8 data as byte stream.

  VERB:
    ADDENTITYTYPE TYPEID SCHEMAURI
    SUBSCRIBETYPE TYPEID NVALUEIDS (VALUEID)+
    UNSUBSCRIBETYPE TYPEID
    ADDENTITY TYPEID ENTITYID NVALUES (VALUE)+
    REMOVENTITY ENTITYID
    UPDATEENTITY ENTITYID NVALUES (VALUE)+
  
  VALUE:
    VALUEID DATA

I looked around for a suitable binary protocol specification/standard method, but couldn't find anything good. Most protocols either just specify the bit fields as words (a la IP headers etc), or start wrapping data in too much gunk. The point is to transmit a minimum of data for each runtime update, but to allow for a rich set of properties on entities. Because entities will send property updates as "property id" plus "value," and the id is encoded as a variable-length int, it's useful to give the lowest property ids to the most-frequently changing properties.

In general, the receiving end of the entity will examine each schema that gets introduced, and decide to subscribe to some amount of the properties defined in that schema. Then, when an entity appears that is an instance of a schema that the receiver is subscribed to, the sending end will make sure to first introduce that entity, and then keep the reveiver up to date with changes in the property values subscribed to.