fgms 0.11.8
The
FlightGear MultiPlayer Server
project
Developers Guide

Source Code

To checkout the source code run

git clone https://gitlab.com/fgms/fgms-0-x.git

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 - mepacketfgmspacketfgms - 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
    HeaderOther data

Header

  • The T_MsgHdr is the c struct used to define the header.
    NameComment
    MagicThe "magic" that must start each packet, see MSG_MAGIC
    ProtoVerThe protocol version which must match - see PROTO_VER
    MsgIdthe MsgId is the "type" of message that is sent
    MsgLenThe length of this message
    ReplyAddr–not-used–
    ReplyPort–not-used–
    CallsignLength 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
    NameComment
    ModelLength is MAX_MODEL_NAME_LEN eg /model/foo/aero.xml
    timeepoch time
    laglag ??
    positiondouble[3]
    orientationfloat[3]
    linearVelfloat[3]
    angularVelfloat[3]
    linearAccelfloat[3]
    angularAccelfloat[3]

XDR

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.