Multiplayer protocol: Difference between revisions

Jump to navigation Jump to search
Cleanup + Out of date
(time and lag are doubles!)
(Cleanup + Out of date)
Line 1: Line 1:
{{Out of date}}
== The messages ==
== The messages ==


Line 8: Line 11:
  |'''Magic'''|'''Version'''|'''MsgId'''|'''MsgLen'''|'''ReplyAddress'''|'''ReplyPort'''|'''Callsign'''|'''Data'''|
  |'''Magic'''|'''Version'''|'''MsgId'''|'''MsgLen'''|'''ReplyAddress'''|'''ReplyPort'''|'''Callsign'''|'''Data'''|


{| class="prettytable" border="1px" cellspacing="0" cellpadding="2"
{| class="wikitable"
|Magic:
|Magic:
|4 bytes, always 0x46474653 ("FGFS")
|4 bytes, always 0x46474653 ("FGFS")
Line 17: Line 20:
|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 - all other values are outdated and ignored
|-
|-
|MsgLen:
|MsgLen:
|4 bytes, the length of the data. '''Important:''' This is not in bytes, see the description of STRING field at the end for more information.
|4 bytes, the length of the data. {{Caution|This is not in bytes, see the description of STRING field at the end for more information.}}
|-
|-
|ReplyAddress:
|ReplyAddress:
Line 38: Line 41:
== Data of position messages ==
== Data of position messages ==
The data of position data is more complicated and looks like this:
The data of position data is more complicated and looks like this:
{| class="prettytable" border="1px" cellspacing="0" cellpadding="2"
{| class="wikitable"
|ModelName
|ModelName
|96 bytes, zero terminated array of characters representing the aircraft model used by the user
|96 bytes, zero terminated array of characters representing the aircraft model used by the user
Line 102: Line 105:
The following properties are transmitted, but not necessarily all present and not in this order:
The following properties are transmitted, but not necessarily all present and not in this order:


'''Important:''' This table is outdated. Please have a look in the flightgear sources at src/MultiPlayer/multiplaymgr.cxx
{{Note|This table is outdated. Please see {{Git link|gitorious|fg/flightgear|master|src/MultiPlayer/multiplaymgr.cxx|text=src/MultiPlayer/multiplaymgr.cxx}} for the current list.}}
{| class="prettytable" border="1px" cellspacing="0" cellpadding="2"
{| class="wikitable"
!ID  !!  Property                                                      || Type(*)
!ID  !!  Property                                                      || [[Multiplayer_protocol#Types|Types]]
|-
|-
|100 || "surface-positions/left-aileron-pos-norm"                      || FLOAT
|100 || "surface-positions/left-aileron-pos-norm"                      || FLOAT
Line 411: Line 414:
|}
|}


== Types ==
The types are XDR encoded as follows:


(*) The types are XDR encoded as follows:
* <tt>INT</tt>:    4 bytes, send unconditionally
 
INT   4 bytes, send unconditionally
 
FLOAT: 4 bytes, send unconditionally


BOOL: 4 bytes, send unconditionally
* <tt>FLOAT</tt>: 4 bytes, send unconditionally


STRING [LEN|STR|PAD]:
* <tt>BOOL</tt>:  4 bytes, send unconditionally
LEN:   4 bytes, length of the decoded string
  STR:    LEN*4 bytes, encoded string.
PAD:    n*4 bytes, padding.


'''Important'''
* <tt>STRING [LEN|STR|PAD]</tt>:
Due to a bug, all bytes in the STRING field are sent as 4byte ints (not in the header or the position message). So STR has length LEN*4 and padding (4-LEN%4)*4 bytes, if LEN%4 != 0.
** <tt>LEN</tt>:    4 bytes, length of the decoded string
** <tt>STR</tt>:    LEN*4 bytes, encoded string.
** <tt>PAD</tt>:    n*4 bytes, padding.
{{Caution|Due to a bug, all bytes in the <tt>STRING</tt> field are sent as 4-byte ints (not in the header or the position message). So STR has length LEN*4 and padding (4-LEN%4)*4 bytes, if LEN%4 is not 0.}}


[[Category:Multiplayer]]
[[Category:Multiplayer]]

Navigation menu