>  from:    David Megginson <[EMAIL PROTECTED]>
>  date:    Tue, 18 Jun 2002 14:53:00
>  to:      [EMAIL PROTECTED]
>  subject: Re: [Flightgear-devel] static variables
> Curt and I have discussed this before (either online or offline).  We
> could certainly have per-vehicle subtrees, i.e.
> and so on, and that would let us share some common, sim-wide
> information at the top level, and would make all program-wide
> information available at a single glance.  The alternative is to use
> the multi-process model rather than a multi-thread model, and to swap
> entire property trees in and out like memory pages; we'll certainly
> avoid a lot of bugs that way (because the wrong properties simply
> won't be available).
> What does everyone else think?

I think it will become clear straight away that the vehicle-specific properties will 
have to be organizationally separated from the base simulator properties.  The initial 
profusion of bugs will be due to treating a property as global when it should really 
be vehicle-specific, and vice versa.  I don't think there that one vehicle will 
accidentally access another vehicle's properties.

You can't swap multiple copies of the _whole_ property tree, because base properties 
would get in a complete mess.  You could swap the major branch that represents the 
vehicle, but you still have to re-organise so that all (and only) relevant properties 
are in that branch.

At that point, the difference between swapping among copies of a branch and indexing 
that branch is fundamentally very little.  The indexing could and should be made 
almost transparent within a given module, say the FDM, by having FDM property accessor 
functions that automatically supply the appropriate index or node pointer for that 
instance of the FDM.  E.g. fdmGetInt("/rudder-pedal-pos") calls 
fgGetInt("/vehicle[n]/fdm/rudder-pedal-pos") [that is just an example of the concept, 
not a suggestion of actual names or style].

Although the reorganisation will be a lot of work, it will improve the modularity and 
clarity of the program design even when it is only running one vehicle.

- Julian

Flightgear-devel mailing list

Reply via email to