Board index FlightGear Development New features

Spectator mode

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Spectator mode

Postby kamikaze » Tue Nov 07, 2017 4:45 pm

Is there any way to inject my own Python code so I could try to write a spectator mode to spectate on any flying jet or move around the map freely?
Posts: 7
Joined: Wed Mar 08, 2017 2:44 pm

Re: Spectator mode

Postby stuart » Tue Nov 07, 2017 8:50 pm

You can do all this from the ufo aircraft - no Python code required. One of the view options allows you to switch between the various MP aircraft. It would be trivial to change this to include AI objects.

User avatar
Posts: 1469
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Spectator mode

Postby bugman » Tue Nov 07, 2017 8:51 pm

I have been working on FGPythonSys to expose the FlightGear internal APIs via Python for exactly such purposes, however this is very far from complete.

Posts: 1718
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: Spectator mode

Postby wkitty42 » Tue Nov 07, 2017 9:20 pm

there is also an Addon (cockpit-view) that allows one to jump into every craft in the sim... using the camera positioning dialog, you can be anywhere in/on/around the craft you have selected to view from...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
Posts: 5760
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Spectator mode

Postby Hooray » Sun Nov 26, 2017 9:01 pm

kamikaze wrote in Tue Nov 07, 2017 4:45 pm:Is there any way to inject my own Python code so I could try to write a spectator mode to spectate on any flying jet or move around the map freely?

First of all, you can get the position/orientation of any aircraft using the multiplayer protocol or other networking options.
However, that doesn't give you anything that you can "render" - because you also need the corresponding 3D world data, e.g. stuff like the surrounding scenery/weather and the actual 3D model and the state of everything else that may be situation-specific (instrument readings, weather settings, radio settings, other traffic etc).
Which is to say, it is really only feasible to create such a feature using the fgfs binary itself.
Like Stuart said, this information, and even the feature you are asking for, is readily available in the form of various hooks that can be used, including a scripting language called "Nasal".

That being said, if you really need to use Python to do the corresponding coding, your best bet might be Torsten's mongoose/Phi work, and getting an image stream out of FlightGear for a set of configurable settings.

If however, the whole thing is really about _any_ "flying jet", it is also worth noting that not even the MP environment is self-contained in that sense, i.e. a fgms server may be mirroring/relaying flight data from another fgms server. And under such circumstances, you may still want to use a local fgfs instance to create the corresponding scenery/aircraft view and render that.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 11375
Joined: Tue Mar 25, 2008 8:40 am

Return to New features

Who is online

Users browsing this forum: No registered users and 1 guest