Messages are the standard communication format for all data moving in and out of WorldQL. Operations such as establishing a connection, updating player position/animation, and modifying the world are all done through Messages. They are encoded using a single Flatbuffer schema.
Messages have the following fields:
- Instruction: Denotes the type of message being sent. Tells the client/server how to interpret the contained data.
- Parameter: A single general purpose string payload. Can be used for whatever data is desired. You can specify a generic string argument, target object ID, etc.
- Sender UUID: The client ID that sent the message. Only used for serverbound messages.
- World name: The World that the message is referring to.
- Records: An array of Records representing permanent objects in the world. Used in both server-bound messages (i.e. creating a new record) and client-bound messages (telling the client about a certain Record).
- Entities: An array of Entities representing living, moving objects in the world. Entities are similar to Records, but are stored only in memory and never written to disk. They are support having Scripts attached to them.
- Position: A 3D vector representing the target position of this Message.
- Flex: A byte array that can be used to pass whatever data the developer desires. You can use any serialization format you want, but Flexbuffers are strongly recommended for their speed and inclusion in the Flatbuffer library.
Confused by what Records, Worlds, and Entities are? Don't worry, we'll explain all of that on the following pages.