5 The core of FlightGear is the property system. This is a tree like internal
6 representation of global variables. The property system is explained more
9 FlightGear' way of doing things is breaking it up into small pieces. There is
10 (for example) animation code that reacts on property changes. There is also a
11 Flight Dynamics model (FDM) that (amongst other things) updates properties.
12 There is a menu system that can display and alter properties. Then we have
13 sound code that plays sound based on ... properties.
15 Maybe you see a pattern evolve by now.
17 All subsystems are almost self containing. Most of the time they only read the
18 values of some properties, and sometimes they alter other properties. This is
19 the basic way of communicating between subsystems.
25 The property system is best described as an in-memory LDAP database which holds
26 the state of global variables. The system has a tree like hierarchy (like a
27 file system) and has a root node, sub nodes (like subdirectories) and end-nodes
30 All variables are kept internally as raw values and can be converted to any
31 other supported type (boolean, int, float double and string).
33 Like a file system, every node can be accessed relative to the current node, or
34 absolute to the root node.
36 The property system also allows aliasing nodes to other nodes (like symbolic
37 linking files or directories to other files or directories) and may be assigned
38 read-only or read-write.
40 If necessary it would be possible for parts of the program to hold it's own
41 property tree, which is inaccessible from the global property tree, by keeping
42 track of it's own root-node.
44 Property I/O code allows one to easily read the tree from, or write the tree to
51 To add a new subsystem you would have to create a derived class from
52 SGSubsystem and define at least a small set of functions:
54 class FGFX : public SGSubsystem
62 virtual void reinit ();
64 virtual void unbind ();
65 virtual void update (double dt);
68 The init() functions should make sure everything is set and ready so the
69 update() function can be run by the main loop. The reinit() function handles
70 everything in case of a reset by the user.
72 The bind() and unbind() functions can be used to tie and untie properties.
74 After that you can register this class at the subsystem manager:
76 globals->add_subsystem("fx", new FGFX);
78 Now the subsystem manager calls the update() function of this class every
79 frame. dt is the time (in seconds) elapsed since the last call.
85 The scripting langage Nasal can also read and modify properties but it can also
86 be incorporated into the menu system. The documentation for Nasal can be found
87 here: http://www.plausible.org/nasal/flightgear.html