Board index FlightGear Development

C++ Simulator

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

C++ Simulator

Postby EvanaShankar » Fri Apr 16, 2021 9:16 am

Moderator note: This post was copied from a reddit post and was after getting replies edited to include a spam URL. The original poster have been permanently banned, but I will leave the topic here in case the answers are of use for someone later.


I enjoy using flight gear but due to the fact it is written in Nasal, it is hard for me to make any changes to it since I do not know the language. Are the any similar open-sourced C++ flight simulators out there anyone would suggest?

THANKS!!
Last edited by Johan G on Sun Apr 18, 2021 6:11 pm, edited 2 times in total.
Reason: Removed spam URL and added note.
EvanaShankar
 
Posts: 1
Joined: Fri Apr 16, 2021 8:55 am

Re: C++ Simulator

Postby danielHL » Fri Apr 16, 2021 9:51 am

The flightgear-core (i.e. the simulator itself) is written in C++. Nasal is just the scripting language used for content and add-on capability development.

Nevertheless, nasal is very easy to learn. But first you need to identify what you want to change: is aircraft development? Nasal will be necessary here. Is it the physics, rendering, scenery pipeline etc? Then look into the src/ directories and all the C++ code.
danielHL / D-FMPW
danielHL
 
Posts: 280
Joined: Fri May 02, 2014 7:23 pm
Callsign: D-FMPW
Version: next
OS: Linux

Re: C++ Simulator

Postby wlbragg » Sat Apr 17, 2021 6:38 am

If you know c++ you should have no trouble with nasal.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7574
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: C++ Simulator

Postby Hooray » Sat Apr 17, 2021 7:45 am

Right, "Nasal" is just a weird name for a FlightGear specific scripting language that's based on JavaScript/ECMAScript concepts - as such, someone with a background/familiarity in C/C++ or Java/JavaScript programming should have no problems whatsoever using it - indeed, it could just as well be called "FlightGear C++" if you prefer that (seriously, at the time back in the early 2000s, people wanted to call it FGScript, and Nasal started out as NASL) :D

Aside from that, there's experimental Python support for extending Flightgear, search the forum/wiki or mailing list for "FGPythonSys" to learn more:

https://wiki.flightgear.org/FGPythonSys
https://wiki.flightgear.org/Python_in_FlightGear

Speaking in general, "Nasal" itself is rarely the problem when it comes to extending FlightGear - if in doubt, run a forum/wiki or mailing list search about replacing Nasal - discussions about replacing Nasal usually tend to mention keywords like "python", "javascript" or "erlang", so you could just as well run a forum search for all of those: search.php?st=0&sk=t&sd=d&sr=posts&keywords=Nasal+Python+erlang+Javascript

https://wiki.flightgear.org/What_is_Nasal
https://wiki.flightgear.org/Nasal_success_stories
https://wiki.flightgear.org/Nasal_FAQ#W ... f_Nasal.3F

Finally, Nasal "the language" is not complicated at all - if you are familiar with basic programming concepts (conditionals/loops/functions, data structures) you can get going very quickly, just by looking at a few examples/snippets and start adapting those as needed. There's even a built-in console to enter/execute Nasal code directly:


https://wiki.flightgear.org/Nasal_Console
Image

Alternatively, try the REPL:
https://wiki.flightgear.org/Interactive_Nasal_REPL
Image

what you will need to read up on are FlightGear specific APIs (extension functions) and modules/libraries - however, that will be the case regardless of the programming language you are using.

Thanks to features like the generic protocol system, telnet/props, HLA, and most recently DDS, you could also implement addons/features separately, even using visual basic or delphi if you wanted to:

https://wiki.flightgear.org/Generic_protocol
https://wiki.flightgear.org/Telnet_usage
https://wiki.flightgear.org/Data_Distri ... es_Support
https://wiki.flightgear.org/High-Level_Architecture
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,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Development

Who is online

Users browsing this forum: No registered users and 6 guests