1
0
Fork 0
Commit graph

643 commits

Author SHA1 Message Date
Stuart Buchanan
236b7c0f83 Multiple LoD levels of MP Aircraft
At a basic level, the implementation supports two levels of LoD:

FAR from /sim/rendering/static-lod/ai-range-bare to /sim/rendering/static-lod/ai-range-detailed.
NEAR from /sim/rendering/static-lod/ai-range-detailed to 0.

(First of many digressions:  If /sim/rendering/static-lod/ai-range-mode-pixel=true then instead of measuring LOD distance in meters, the size of the object in pixels is used, so the ranges are different)

The models that are loaded for FAR and NEAR depend on a combination of the availability of a model in /AI/AIrcraft/ and FG_AIRCRAFT directories.

If /sim/rendering/static-lod/ai-range-detailed=false then an AI aircraft will be used in preference for both NEAR and FAR.

If /sim/rendering/static-lod/ai-range-detailed=true then an AI aircraft will be used for FAR, and an FG_AIRCRAFT for NEAR.

Obviously if only an AI or a FG_AIRCRAFT model are available, that will be used for the entire NEAR+FAR range.
2018-06-05 21:58:03 +01:00
Stuart Buchanan
9de3672b62 Property to toggle between preferred MP models
/sim/multiplay/use-detailed-models can be used to set whether
we will prefer models from Aircraft/ (true) or from AI/ (false).

Default (set in defaults.xml in fgdata) is true.
2018-05-28 20:54:09 +01:00
James Turner
dc6a884928 Generalise AI-model search ordering in AIBase
Make the policy of using models in FGData/AI more flexible, with the
option to prefer normal data sources. Keep the existing behaviour for
everything except multiplayer aircraft, where we now prefer the data
model (presumably, an installed aircraft) over the AI one.
2018-05-23 09:46:05 +01:00
Richard Harrison
d6556f5c94 Multiplayer: consistent callsign in properties.
To ensure consistent properties also tie the callsign to where it would be in a local model.
2018-05-13 06:45:44 +02:00
James Turner
13857e001e Add override decls in AIManager
(Done while tracing another crash, but committing separately)
2018-04-29 10:12:40 +01:00
James Turner
2a31893862 Fix a crash when updating the user aircraft 2018-04-27 23:32:28 +01:00
ThomasS
3dcac53952 camelCase identifier in code and hyphenated property names. Suffix "-sec" is used because it complies to other timestamp properties in the property tree. Suffix "utc" is not used because the property just reflects an internal value used by the AI system. Whether it is UTC (currently it is) is up to the AI system and cannot be defined by the property name. 2018-04-24 09:54:35 +02:00
ThomasS
94f82c47ef Additional departure airport/time and arrival airport/time information in the property tree for AI aircraft. 2018-04-24 06:20:28 +02:00
James Turner
22cf6bd5e4 Fix a crash found by a space cowboy :)
Thanks to Tobias Dammers
2018-04-12 17:38:12 +02:00
James Turner
9000185b92 Improve AI parking-pushback warning message
Specify the airport when a parking has no associated pushback route.
Improvement from WKitty42
2018-04-05 12:58:58 +01:00
Richard Harrison
48563acdd2 Multiplayer: lag adjustment clock mode initialization.
Ensure the property is initialized to zero during AI MP model binding.
2018-02-17 12:22:14 +01:00
jean pellotier
b9b280abd1 a new clock following real time pace, for mp protocol
the current timestamp used in mp protocol and in AImultiplayer is not a good one:
it can pause, or even change speed if we change warp value.
we want it to be used for network protocol lag and jitter estimation, and
a time flowing linearly on both side is needed, here's a first introduction
of this timestamp relates to real elapsed time.
here it's initialised to the system clock, then follow the monotonic clock.
in future improvement, it will allow time synchronisation betwen mp players,
to have a very good close formation flight experience.
2018-01-29 12:51:43 +01:00
jean pellotier
2e919544b9 warning removal, forgot to remove ival when addressing bug 1885
it was the commit  2f84be16f9
2018-01-28 14:49:07 +01:00
Richard Harrison
2f84be16f9 Multiplayer: Do not interpolate integer values:
Jean Pellotier, 2018-01-02 : we don't want interpolation for integer values, they are mostly used
for non linearly changing values (e.g. transponder etc ...)
ref: https://sourceforge.net/p/flightgear/codetickets/1885/
2018-01-04 03:54:23 +01:00
Florent Rougon
a2254d891a Add missing include <algorithm> for std::max() and std::min()
<algorithm> was missing in src/AIModel/AIFlightPlanCreate.cxx and
src/Navaids/routePath.cxx. Thanks again to Alan Teeder for the reports!
2017-11-16 12:54:49 +01:00
James Turner
b7a2e993b6 Fix crash in traffic code
Hit an exception where no runway node was found creating the landing taxi.
Probably should not happen but anyway let's not crash
2017-09-29 12:49:22 +01:00
James Turner
a8e1fd4fd0 Move the user aircraft proxy into the AIManger
This should ensure there is always a proxy for the user in the AI
world for parking and ATC purposes.
2017-09-26 16:52:48 +01:00
James Turner
bb6510ad68 De-Boost-ify the AIManger, modernise to C++11 2017-09-26 16:52:48 +01:00
James Turner
66eb3d2690 Use a unique_ptr to manage FGAIFlightPlan 2017-09-21 18:37:14 +01:00
James Turner
bf2c363e50 Fix carrier starts
Rewrite the position-init code for carrier starts, to precisely wait
on the carrier model being loaded, before proceeding with FDM init.
This allows the FDM to see the correct carrier model in the ground
cache, and hence avoids starting in the water.

To implement this, the CheckSceneryVisitor is used to force the carrier
model to be loaded while the splash-screen is visible.
2017-09-08 22:31:22 +01:00
James Turner
b19fe7be7d Make some AI-traffic warnings DEV_WARN
This reduces the log noise in release builds, relating to AI ground-nets
with incomplete data, especially the commonly occurring ‘gate XYZ
doesn’t seem to have any routes associated with it’ message.

https://sourceforge.net/p/flightgear/codetickets/1974/
2017-07-20 18:00:49 +01:00
Richard Harrison
2c8aad12ba Model relative property tree root binding.
Change fgcommand to take an optional property tree root element.

This fixes the animation bindings to use the defined property tree root - to support multiplayer (or other) model that can bind to the correct part of the property tree.

Requires a corresponding fix in sg to allow the command methods to take an optional root parameter.

What this means is that when inside someone else's multiplayer model (e.g. backseat, or co-pilot), the multipalyer (AI) model will correctly modify properties inside the correct part of the property tree inside (/ai), rather than modifying the properties inside the same part of the tree as the non-ai model.

This means that a properly setup model will operate within it's own space in the property tree; and permit more generic multiplayer code to be written.

This is probably responsible for some of the pollution of the root property tree with MP aircraft properties.
2017-07-05 11:37:17 +02:00
Bertrand Coconnier
b5fe38c1eb Compile AI wake numerical core in FG main executable.
AI wake code is still dead code except that it is now compiled with FG.

Input data for wake computations are extracted from the performance database. The data must be specified as follows (values are for illustration only) :
<geometry>
  <wing>
    <span-ft> 100. </span-ft>
    <chord-ft> 12. <chord-ft>
  </wing>
  <weight-lbs> 90000. </weight-lbs>
</geometry>
2017-06-10 20:19:43 +02:00
Bertrand Coconnier
34a0c6c2a8 Make some methods public for the AI wake feature.
In order to compute the AI aircrafts wake, the FDM will need access to the list of AI aircrafts as well as being able to compute their range to discard aircrafts which are too far.
2017-06-10 15:28:28 +02:00
Florent Rougon
eefa9a75f9 Fix crash in AI code when buggy groundnet declares pushback hold point on runway
Some buggy *.groundnet.xml files (as KSEA currently on TS) define the
pushback hold point for some parking positions as a node on a runway.
In this case, this the pushback hold point for parking
'North_Cargo_Ramp', defined as node 5344 in
Airports/K/S/E/KSEA.groundnet.xml, which is defined twice (second error),
first as:

<node index="5344" lat="N47 27.774559" lon="W122 18.465257" isOnRunway="1" holdPointType="PushBack"  />

and then as:

<node index="5344" lat="N47 27.725747" lon="W122 18.159649" isOnRunway="1" holdPointType="PushBack"  />

(due to code in flightgear/src/Airports/dynamicloader.cxx, it should be
the second one that wins, which is not on a runway but on apron in the
north cargo area)

As a consequence, when this gate is selected for an AI aircraft, the
pushback route has only one node (since the pushback hold point is then
the closest point to itself supposedly on runway!), and the
corresponding FGTaxiRoute instance has an empty 'routes' member
variable, which FGTaxiRoute::next() doesn't handle gracefully
(segfault).

It may be that an additional check/change could be desirable in
FGTaxiRoute::next() in such a case (one node and obviously no route in
the FGTaxiRoute instance), however I'm not sure how Durk wants this case
to be handled, since FGTaxiRoute::next() seems to iterate on nodes.

This fixes the bug reported at:

  https://forum.flightgear.org/viewtopic.php?p=308397#p308397 and
  https://sourceforge.net/p/flightgear/mailman/message/35776552/

Thanks to yanfiz and wkitty42 for the report, and to gooneybird for
inspecting the groundnet file.
2017-04-14 12:25:00 +02:00
James Turner
3653508412 Build- and run-time concept of developer mode.
Make a single Cmake value to expose the build type to code, and use
this to default a run-time ‘developer-mode’ property, which can be
over-ridden from the command line.

Use this to drive the different warning levels. Policies subject to
review, especially whether nightly builds should default to 
developer mode or not.
2017-02-27 23:37:59 +00:00
Peter Sadrozinski
ec4b9f8542 Alternative terrain engine based on pagedLOD
- remove TileMgr from sub systems - add to btg terrain engine
2017-02-26 10:17:15 -05:00
Richard Harrison
2226428b85 AI Multiplayer interpolation.
Whilst debugging I had a cannot increment nextIt - because it was at end(). No idea if this could ever happen in flight but it still seems sensible to protect against it.
2017-02-16 20:53:44 +01:00
Erik Hofman
05b2b6536b Make use of the Vector new interpolation function 2017-02-02 11:35:55 +01:00
Richard Harrison
0bf80f9b2a Add protection to the multiplayer (AI) interpolation to protect against segfaults when the previous and next packets contain different properties. 2017-01-30 23:25:00 +01:00
Erik Hofman
cf935b5882 Try to prevent a possible device-by-zero 2017-01-05 14:35:50 +01:00
Torsten Dreyer
994ea1674b replace many auto_ptr by unique_ptr 2016-11-14 22:20:46 +01:00
James Turner
1c4656512a Enforce separation of ground-net and dynamics.
This ensures ground-network is retrieved through the airport only, and
hence can be done safely early in init, when ATC/AI/dynamics don’t
exist yet.
2016-11-13 14:05:20 +00:00
James Turner
ac33092032 Fix crash disabling AI traffic at runtime.
https://sourceforge.net/p/flightgear/codetickets/1848/
2016-10-20 22:52:27 +01:00
James Turner
6d0c2070fd Use future-proof SGPath APIs.
Remove uses of .str(), .c_str() and some other methods of SGPath.
Pass SGPath directly where possible, or explicitly convert to the
appropriate 8-bit encoding.
2016-06-28 10:08:38 +01:00
James Turner
03ecac9dbc Work with new SGPath API. 2016-06-22 17:36:05 +01:00
James Turner
de959a14f3 Rename Viewer/viewer.cxx to view
- keep class and file names in sync.
2016-02-17 21:25:39 +00:00
James Turner
eb0f724c13 Fix a typo breaking some takeoff-state logic. 2016-01-12 17:26:06 -06:00
James Turner
704aba9041 Fix a dumb AI traffic bug I introduced. 2016-01-06 22:27:33 -06:00
James Turner
b2bec04733 Fix acceleration path of default takeoff taxi. 2016-01-06 17:58:24 -06:00
James Turner
540d4c2111 Use SGTime instead of time() in traffic/AI code
- avoids manual handling of /sim/time/warp in many places
2016-01-05 23:19:28 -06:00
James Turner
ac146f5658 Remove dt member of AIAircraft 2016-01-05 23:19:28 -06:00
James Turner
7644c74df9 Better Traffic performance data warnings. 2015-12-22 15:15:27 -06:00
James Turner
83ea6d32d0 Make PerformanceDB a real subsystem 2015-12-19 00:29:00 -08:00
James Turner
0e71a9593b Quiet down Traffic error logging. 2015-12-18 21:59:28 -08:00
James Turner
a55c939c5e Fix a JSBSim crash on OSG-quit
(i.e Cmd-Q / window closing, not the normal FlightGear quit sequence)
2015-12-11 12:49:32 -06:00
James Turner
8877b442f8 ATC/Traffic doesn’t crash reset.
- remove some global headers from AI headers, to avoid pollution
- change how ATC owns the ‘player’ FGAIAircraft so reset works
- ensure AIAircraft controllers are cleared on unbind for reset
2015-12-11 12:11:59 -06:00
James Turner
6446d67431 Split GroundNetwork class down the middle
- ATC functions move to GroundController, which layers above
  remaining GroundNetwork functionality
- dynamics owns both the groundNetwork and the ground controller.
2015-12-10 15:53:05 -06:00
James Turner
fc887b106b Checkpoint - ground-net skips the cache 2015-12-01 14:01:32 +00:00
James Turner
2314ccfe13 Developer-warnings
- make some existing warnings developer-mode only
- add a warning about legacy aircraft path usage
2015-11-13 22:13:44 +00:00