Table of Contents
GameBots text protocol features commands and messages. All commands and messages share common text format. Example of one GameBots messages is:
PLAYER {Name GoodBot} {Location 1400,500,0} {Rotation 32000,0,0} {Health 100} {Height 170.59} {IsHuman False}
The first characters up to first space (excluding it) are the message type. Then enclosed by a pair of vinculums ( characters “{“ and “}” ) come attribute pairs. Attribute pair consist of attribute name and attribute value. Attribute name is all characters after the left vinculum (character “{“) up to the first space (excluding the space). Attribute value is all characters after the first space up to the right vinculum (character “}”). This means attribute values may contain spaces. Attribute pairs should be always divided by a space.
So the correct parsing of our example above would be:
Message type – PLAYER
Attribute 1 – Name of the attribute is “Name”. Value of the attribute is “GoodBot”.
Attribute 2 – Name of the attribute is “Location”. Value of the attribute is “1400,500,0”.
Attribute 3 – Name of the attribute is “Rotation”. Value of the attribute is “32000,0,0”.
Attribute 4 – Name of the attribute is “Health”. Value of the attribute is “100”.
Attribute 5 – Name of the attribute is “Height”. Value of the attribute is “170.69”.
Attribute 6 – Name of the attribute is “IsHuman”. Value of the attribute is “False”.
Number of attributes is not limited for messages. For commands the limit exists – for Pogamut GameBots it is 32.
Data types used by GameBots are UnrealScript common data structures. The most used types in GameBots are intergers or real numbers (attributes Health and Height), strings (attribute GoodBot), booleans (attribute IsHuman) and vector and angle structures (attributes Location and Rotation).
For measuring position and angles in UT04 so called unreal units were defined. One unreal unit corresponds roughly to 1 cm. For angles full rotation (by 360 degrees) corresponds to 65535 rotation unreal units. To convert to radians simply divide the number by 65535 and multiply by 2 * pi.
Vector structures are usually used to define positions (attribute Location in our example). Vector is a triple defining x,y and z coordinate in UT04 environment. Rotation structures are used to measure rotation of the objects (attribute Rotation in our example). Rotation structure is also a triple consisting of pitch, yaw and roll. Pitch is up and down, yaw is side to side and roll is the equivalent of doing a cartwheel.