Source Code
- The source for the project is versioned using git
- The repository is hosted at sourceforge.net
To checkout the source code run
Code Layout
- src/
- contrib/
- fgracker/ - the Tracker Server
- mpstatus/ - a www page and perl script to query mp statuses
- plib/ - see plib below
- tools/ - contains check_fgms.sh, a script to check fgms status
- docs/ - stuff to do with documentation in this page
Other Libs
The fgms repository contains all the libs required to install. However some parts were copied, borrowed etc from other sources:
simgear
plib
flightgear
MultiPlayer Overview
This is an overview about how the communicatinons works between fgfs instances via an fgms.
- The table below shows communications with three players over a network
- Messages are sent a few times a second
fgms - me | packet | fgms | packet | fgms - others |
me | > send > | > relay > | > recv > | other 1 |
| | | > recv > | other 2 |
me | < recv < | < relay < | < send < | other 1 |
| | > relay > | > recv > | other 2 |
Data Interchange
- Send
- packets are assembled on an fgfs instance, values such as callsign, position, speed etc
- the values are packaged into an XDR encoded binary blob
- the packet is transmitted via udp out to an mp server
- eg –multiplayer=out,15,mpserver14.flightgear.org,5000
- MpServer
- Reciever
- a fgms client the other ends will recive the packet
- decode the data encoded in XDR
- then update the sim with this data
- And < vice > versa
Data Packets
- The data encoded into a sequence of bytes using XDR.
- Every packet starts with 'Header' bytes which define whats in the rest of the packet.
An Mp Message Packet |
Header | Other data |
Header
- The T_MsgHdr is the c struct used to define the header.
Name | Comment |
Magic | The "magic" that must start each packet, see MSG_MAGIC |
ProtoVer | The protocol version which must match - see PROTO_VER |
MsgId | the MsgId is the "type" of message that is sent |
MsgLen | The length of this message |
ReplyAddr | –not-used– |
ReplyPort | –not-used– |
Callsign | Length is MAX_CALLSIGN_LEN abc123 |
- T_MsgHdr::MsgId - the MsgId is one of:
- ::POS_DATA_ID - a position message and the most trafficked
- ::RESET_DATA_ID - to reset ?
- CHAT_MSG_ID - for mp chat BUT
- Warning
- CHAT_MSG_ID is not used in current implementation. Instead chat is packaged into properties.
Position Message
- T_PositionMsg is the c struct used to define a position
Name | Comment |
Model | Length is MAX_MODEL_NAME_LEN eg /model/foo/aero.xml |
time | epoch time |
lag | lag ?? |
position | double[3] |
orientation | float[3] |
linearVel | float[3] |
angularVel | float[3] |
linearAccel | float[3] |
angularAccel | float[3] |
XDR
- External Data Representation
XDR is a standard data serialization format. It allows data to be transferred between different kinds of computer systems. Converting from the local representation to XDR is called encoding. Converting from XDR to the local representation is called decoding. XDR is implemented as a software library of functions which is portable between different operating systems and is also independent of the transport layer.
fgms uses a small subset of xdr necessary for multiplayer. This is defined in tiny_xdr.hxx
Contribute
You are more than welcome to contribute to the project.
Documentation
The documentation is created using doxygen and is generated from source.
- Here for some formating info
- Private variables/function are documented
- Pages, ie stuff not related to source such as this page are in /doc/pages/
- The doxygen tag file is located at fgms.tag
- Doxygen 1.8+ is required for building the documents.