Multiplayer protocol: Difference between revisions
Oschroeder (talk | contribs) |
m (Robot: Cosmetic changes) |
||
Line 16: | Line 16: | ||
|- | |- | ||
|MsgId: | |MsgId: | ||
|4 bytes, defines what data is appended to the header. Can be 0x00000001 for chat messages (deprecated) or<br> | |4 bytes, defines what data is appended to the header. Can be 0x00000001 for chat messages (deprecated) or<br /> | ||
0x00000007 for position data<br>all other values are outdated and ignored | 0x00000007 for position data<br />all other values are outdated and ignored | ||
|- | |- | ||
|MsgLen: | |MsgLen: | ||
Line 47: | Line 47: | ||
|lag || 8 bytes, time offset for network lag | |lag || 8 bytes, time offset for network lag | ||
|- | |- | ||
|PosX || 8 bytes, XDR encoded double value, X-ccordinate of users<br> | |PosX || 8 bytes, XDR encoded double value, X-ccordinate of users<br /> | ||
position wrt the earth centered frame | position wrt the earth centered frame | ||
|- | |- | ||
|PosY || 8 bytes, XDR encoded double value, Y-ccordinate of users<br> | |PosY || 8 bytes, XDR encoded double value, Y-ccordinate of users<br /> | ||
position wrt the earth centered frame | position wrt the earth centered frame | ||
|- | |- | ||
Line 68: | Line 68: | ||
|VelZ || 4 bytes, XDR encoded float value, velocity of the user in Z direction wrt the earth centered frame measured in the earth centered frame | |VelZ || 4 bytes, XDR encoded float value, velocity of the user in Z direction wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AV1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional angular velocity vector<br> | |AV1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional angular velocity vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AV2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional angular velocity vector<br> | |AV2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional angular velocity vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AV3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional angular velocity vector<br> | |AV3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional angular velocity vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|LA1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional linear accelaration vector<br> | |LA1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional linear accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|LA2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional linear accelaration vector<br> | |LA2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional linear accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|LA3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional linear accelaration vector<br> | |LA3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional linear accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AA1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional angular accelaration vector<br> | |AA1 || 4 bytes, XDR encoded float value, 1. part of the three dimensional angular accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AA2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional angular accelaration vector<br> | |AA2 || 4 bytes, XDR encoded float value, 2. part of the three dimensional angular accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- | ||
|AA3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional angular accelaration vector<br> | |AA3 || 4 bytes, XDR encoded float value, 3. part of the three dimensional angular accelaration vector<br /> | ||
wrt the earth centered frame measured in the earth centered frame | wrt the earth centered frame measured in the earth centered frame | ||
|- | |- |
Revision as of 18:42, 8 March 2011
The messages
All messages are composed of XDR encoded data. (see RFC 1832 for a complete description of XDR). XDR basically means: All data is in network byte order and aligned to the nearest multiple of 4 bytes. Strings are encoded as a zero-terminated array of characters,aligned to the nearest multiple of 4 bytes. Floating point numbers (32 or 64 bit) must be encode in the IEEE standard.
The header
The header is always 32 bytes long and contains the following fields in exactly that order:
|Magic|Version|MsgId|MsgLen|ReplyAddress|ReplyPort|Callsign|Data|
Magic: | 4 bytes, always 0x46474653 ("FGFS") |
Version: | 4 bytes, protocol version, currently 0x00010001 (1.1) |
MsgId: | 4 bytes, defines what data is appended to the header. Can be 0x00000001 for chat messages (deprecated) or 0x00000007 for position data |
MsgLen: | 4 bytes, the lenght of the data in bytes |
ReplyAddress: | 4 bytes, deprecated and ignored |
ReplyPort: | 4 bytes, deprecated and ignored |
Callsign: | 8 bytes, zero terminated array of characters representing
the user callsign |
Data of chat messages
The data for chat messages is a zero terminated array of characters. The MsgLen field in the header represents its length. The maximum length is defined to be 256 bytes.
Data of position messages
The data of position data is more complicated and looks like this:
ModelName | 96 bytes, zero terminated array of characters representing the aircraft model used by the user |
time | 8 bytes, representing the time when this message was generated |
lag | 8 bytes, time offset for network lag |
PosX | 8 bytes, XDR encoded double value, X-ccordinate of users position wrt the earth centered frame |
PosY | 8 bytes, XDR encoded double value, Y-ccordinate of users position wrt the earth centered frame |
PosZ | 8 bytes, XDR encoded double value, z-ccordinate of users
position wrt the earth centered frame |
OriX | 4 bytes, XDR encoded float value, X-orientation of the user wrt the earth centered frame, stored in the angle axis representation where the angle is coded into the axis length |
OriY | 4 bytes, XDR encoded float value, Y-orientation of the user wrt the earth centered frame, stored in the angle axis representation where the angle is coded into the axis length |
OriZ | 4 bytes, XDR encoded float value, Z-orientation of the user wrt the earth centered frame, stored in the angle axis representation where the angle is coded into the axis length |
VelX | 4 bytes, XDR encoded float value, velocity of the user in X direction wrt the earth centered frame measured in the earth centered frame |
VelY | 4 bytes, XDR encoded float value, velocity of the user in Y direction wrt the earth centered frame measured in the earth centered frame |
VelZ | 4 bytes, XDR encoded float value, velocity of the user in Z direction wrt the earth centered frame measured in the earth centered frame |
AV1 | 4 bytes, XDR encoded float value, 1. part of the three dimensional angular velocity vector wrt the earth centered frame measured in the earth centered frame |
AV2 | 4 bytes, XDR encoded float value, 2. part of the three dimensional angular velocity vector wrt the earth centered frame measured in the earth centered frame |
AV3 | 4 bytes, XDR encoded float value, 3. part of the three dimensional angular velocity vector wrt the earth centered frame measured in the earth centered frame |
LA1 | 4 bytes, XDR encoded float value, 1. part of the three dimensional linear accelaration vector wrt the earth centered frame measured in the earth centered frame |
LA2 | 4 bytes, XDR encoded float value, 2. part of the three dimensional linear accelaration vector wrt the earth centered frame measured in the earth centered frame |
LA3 | 4 bytes, XDR encoded float value, 3. part of the three dimensional linear accelaration vector wrt the earth centered frame measured in the earth centered frame |
AA1 | 4 bytes, XDR encoded float value, 1. part of the three dimensional angular accelaration vector wrt the earth centered frame measured in the earth centered frame |
AA2 | 4 bytes, XDR encoded float value, 2. part of the three dimensional angular accelaration vector wrt the earth centered frame measured in the earth centered frame |
AA3 | 4 bytes, XDR encoded float value, 3. part of the three dimensional angular accelaration vector wrt the earth centered frame measured in the earth centered frame |
pad | up to 8 bytes for padding the data to a multiple of 8 bytes |
This data is followed by property-values, which are encoded in the form ID|Value
The following properties are transmitted, but not necessarily all present and not in this order:
ID | Property | Type(*) |
---|---|---|
100 | "surface-positions/left-aileron-pos-norm" | FLOAT |
101 | "surface-positions/right-aileron-pos-norm" | FLOAT |
102 | "surface-positions/elevator-pos-norm" | FLOAT |
103 | "surface-positions/rudder-pos-norm" | FLOAT |
104 | "surface-positions/flap-pos-norm" | FLOAT |
105 | "surface-positions/speedbrake-pos-norm" | FLOAT |
106 | "gear/tailhook/position-norm" | FLOAT |
107 | "gear/launchbar/position-norm" | FLOAT |
108 | "gear/launchbar/state" | STRING |
109 | "gear/launchbar/holdback-position-norm" | FLOAT |
110 | "canopy/position-norm" | FLOAT |
111 | "surface-positions/wing-pos-norm" | FLOAT |
112 | "surface-positions/wing-fold-pos-norm" | FLOAT |
200 | "gear/gear[0]/compression-norm" | FLOAT |
201 | "gear/gear[0]/position-norm" | FLOAT |
210 | "gear/gear[1]/compression-norm" | FLOAT |
211 | "gear/gear[1]/position-norm" | FLOAT |
220 | "gear/gear[2]/compression-norm" | FLOAT |
221 | "gear/gear[2]/position-norm" | FLOAT |
230 | "gear/gear[3]/compression-norm" | FLOAT |
231 | "gear/gear[3]/position-norm" | FLOAT |
240 | "gear/gear[4]/compression-norm" | FLOAT |
241 | "gear/gear[4]/position-norm" | FLOAT |
300 | "engines/engine[0]/n1" | FLOAT |
301 | "engines/engine[0]/n2" | FLOAT |
302 | "engines/engine[0]/rpm" | FLOAT |
310 | "engines/engine[1]/n1" | FLOAT |
311 | "engines/engine[1]/n2" | FLOAT |
312 | "engines/engine[1]/rpm" | FLOAT |
320 | "engines/engine[2]/n1" | FLOAT |
321 | "engines/engine[2]/n2" | FLOAT |
322 | "engines/engine[2]/rpm" | FLOAT |
330 | "engines/engine[3]/n1" | FLOAT |
331 | "engines/engine[3]/n2" | FLOAT |
332 | "engines/engine[3]/rpm" | FLOAT |
340 | "engines/engine[4]/n1" | FLOAT |
341 | "engines/engine[4]/n2" | FLOAT |
342 | "engines/engine[4]/rpm" | FLOAT |
350 | "engines/engine[5]/n1" | FLOAT |
351 | "engines/engine[5]/n2" | FLOAT |
352 | "engines/engine[5]/rpm" | FLOAT |
360 | "engines/engine[6]/n1" | FLOAT |
361 | "engines/engine[6]/n2" | FLOAT |
362 | "engines/engine[6]/rpm" | FLOAT |
370 | "engines/engine[7]/n1" | FLOAT |
371 | "engines/engine[7]/n2" | FLOAT |
372 | "engines/engine[7]/rpm" | FLOAT |
380 | "engines/engine[8]/n1" | FLOAT |
381 | "engines/engine[8]/n2" | FLOAT |
382 | "engines/engine[8]/rpm" | FLOAT |
390 | "engines/engine[9]/n1" | FLOAT |
391 | "engines/engine[9]/n2" | FLOAT |
392 | "engines/engine[9]/rpm" | FLOAT |
800 | "rotors/main/rpm" | FLOAT |
801 | "rotors/tail/rpm" | FLOAT |
810 | "rotors/main/blade[0]/position-deg" | FLOAT |
811 | "rotors/main/blade[1]/position-deg" | FLOAT |
812 | "rotors/main/blade[2]/position-deg" | FLOAT |
813 | "rotors/main/blade[3]/position-deg" | FLOAT |
820 | "rotors/main/blade[0]/flap-deg" | FLOAT |
821 | "rotors/main/blade[1]/flap-deg" | FLOAT |
822 | "rotors/main/blade[2]/flap-deg" | FLOAT |
823 | "rotors/main/blade[3]/flap-deg" | FLOAT |
830 | "rotors/tail/blade[0]/position-deg" | FLOAT |
831 | "rotors/tail/blade[1]/position-deg" | FLOAT |
900 | "sim/hitches/aerotow/tow/length" | FLOAT |
901 | "sim/hitches/aerotow/tow/elastic-constant" | FLOAT |
902 | "sim/hitches/aerotow/tow/weight-per-m-kg-m" | FLOAT |
903 | "sim/hitches/aerotow/tow/dist" | FLOAT |
904 | "sim/hitches/aerotow/tow/connected-to-property-node" | BOOL |
905 | "sim/hitches/aerotow/tow/connected-to-ai-or-mp-callsign" | STRING |
906 | "sim/hitches/aerotow/tow/brake-force" | FLOAT |
907 | "sim/hitches/aerotow/tow/end-force-x" | FLOAT |
908 | "sim/hitches/aerotow/tow/end-force-y" | FLOAT |
909 | "sim/hitches/aerotow/tow/end-force-z" | FLOAT |
930 | "sim/hitches/aerotow/is-slave" | BOOL |
931 | "sim/hitches/aerotow/speed-in-tow-direction" | FLOAT |
932 | "sim/hitches/aerotow/open" | BOOL |
933 | "sim/hitches/aerotow/local-pos-x" | FLOAT |
934 | "sim/hitches/aerotow/local-pos-y" | FLOAT |
935 | "sim/hitches/aerotow/local-pos-z" | FLOAT |
1001 | "controls/flight/slats" | FLOAT |
1002 | "controls/flight/speedbrake" | FLOAT |
1003 | "controls/flight/spoilers" | FLOAT |
1004 | "controls/gear/gear-down" | FLOAT |
1005 | "controls/lighting/nav-lights" | FLOAT |
1006 | "controls/armament/station[0]/jettison-all" | BOOL |
1100 | "sim/model/variant" | INT |
1101 | "sim/model/livery/file" | STRING |
1200 | "environment/wildfire/data" | STRING |
10001 | "sim/multiplay/transmission-freq-hz" | STRING |
10002 | "sim/multiplay/chat" | STRING |
10100 | "sim/multiplay/generic/string[0]" | STRING |
10101 | "sim/multiplay/generic/string[1]" | STRING |
10102 | "sim/multiplay/generic/string[2]" | STRING |
10103 | "sim/multiplay/generic/string[3]" | STRING |
10104 | "sim/multiplay/generic/string[4]" | STRING |
10105 | "sim/multiplay/generic/string[5]" | STRING |
10106 | "sim/multiplay/generic/string[6]" | STRING |
10107 | "sim/multiplay/generic/string[7]" | STRING |
10108 | "sim/multiplay/generic/string[8]" | STRING |
10109 | "sim/multiplay/generic/string[9]" | STRING |
10110 | "sim/multiplay/generic/string[10]" | STRING |
10111 | "sim/multiplay/generic/string[11]" | STRING |
10112 | "sim/multiplay/generic/string[12]" | STRING |
10113 | "sim/multiplay/generic/string[13]" | STRING |
10114 | "sim/multiplay/generic/string[14]" | STRING |
10115 | "sim/multiplay/generic/string[15]" | STRING |
10116 | "sim/multiplay/generic/string[16]" | STRING |
10117 | "sim/multiplay/generic/string[17]" | STRING |
10118 | "sim/multiplay/generic/string[18]" | STRING |
10119 | "sim/multiplay/generic/string[19]" | STRING |
10200 | "sim/multiplay/generic/float[0]" | FLOAT |
10201 | "sim/multiplay/generic/float[1]" | FLOAT |
10202 | "sim/multiplay/generic/float[2]" | FLOAT |
10203 | "sim/multiplay/generic/float[3]" | FLOAT |
10204 | "sim/multiplay/generic/float[4]" | FLOAT |
10205 | "sim/multiplay/generic/float[5]" | FLOAT |
10206 | "sim/multiplay/generic/float[6]" | FLOAT |
10207 | "sim/multiplay/generic/float[7]" | FLOAT |
10208 | "sim/multiplay/generic/float[8]" | FLOAT |
10209 | "sim/multiplay/generic/float[9]" | FLOAT |
10210 | "sim/multiplay/generic/float[10]" | FLOAT |
10211 | "sim/multiplay/generic/float[11]" | FLOAT |
10212 | "sim/multiplay/generic/float[12]" | FLOAT |
10213 | "sim/multiplay/generic/float[13]" | FLOAT |
10214 | "sim/multiplay/generic/float[14]" | FLOAT |
10215 | "sim/multiplay/generic/float[15]" | FLOAT |
10216 | "sim/multiplay/generic/float[16]" | FLOAT |
10217 | "sim/multiplay/generic/float[17]" | FLOAT |
10218 | "sim/multiplay/generic/float[18]" | FLOAT |
10219 | "sim/multiplay/generic/float[19]" | FLOAT |
10300 | "sim/multiplay/generic/int[0]" | INT |
10301 | "sim/multiplay/generic/int[1]" | INT |
10302 | "sim/multiplay/generic/int[2]" | INT |
10303 | "sim/multiplay/generic/int[3]" | INT |
10304 | "sim/multiplay/generic/int[4]" | INT |
10305 | "sim/multiplay/generic/int[5]" | INT |
10306 | "sim/multiplay/generic/int[6]" | INT |
10307 | "sim/multiplay/generic/int[7]" | INT |
10308 | "sim/multiplay/generic/int[8]" | INT |
10309 | "sim/multiplay/generic/int[9]" | INT |
10310 | "sim/multiplay/generic/int[10]" | INT |
10311 | "sim/multiplay/generic/int[11]" | INT |
10312 | "sim/multiplay/generic/int[12]" | INT |
10313 | "sim/multiplay/generic/int[13]" | INT |
10314 | "sim/multiplay/generic/int[14]" | INT |
10315 | "sim/multiplay/generic/int[15]" | INT |
10316 | "sim/multiplay/generic/int[16]" | INT |
10317 | "sim/multiplay/generic/int[17]" | INT |
10318 | "sim/multiplay/generic/int[18]" | INT |
10319 | "sim/multiplay/generic/int[19]" | INT |
(*) The types are XDR encoded as follows:
INT 4 bytes, send unconditionally
FLOAT: 4 bytes, send unconditionally
BOOL: 4 bytes, send unconditionally
STRING [LEN|STR|PAD]: send only when length > 0 LEN: 4 bytes, length of the string STR: n bytes, string string itself PAD: n bytes, padding so the overall length is a multiple of 4