Mission Editor

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.


Marius_a has a working prototype of a mission system on my local copy of FG, but is limited by his imagination while creating actual missions. If you are willing to write some scenarios and test the missions, he would like to collaborate.[1]

Getting involved

For starters, Marius wants to create a few simple missions that could be completed in less than 15 minutes.[2]

He would like you to write a scenario of suggested mission. For example, if you could write something like this:[3]

    Mission summary:

    Start at lat: 21.98269998, lon: -159.345474 . Aircraft: ec135. Doors opened;
    Load a passenger, start the aircraft, take-off and fly to the destination [lat: 21.97857529, lon: -159.3473686].
    Do a full-stop landing and unload a passenger.

    Mission segments:

    [Mission started]
    Message: "A tourist is ready to fly to the airport"
    Model: [3d model of a tourist] lat: 21.98266138, lon: -159.3454324

    [Passenger loaded]
    Message: "Start the engines"
    Model: [remove 3d model of a tourist]

    [Engines started]
    Message: "You are cleared to take-off"

    Message: "Follow the mission compass"
    Show mission compass [point of interest: lat: 21.97857529, lon: -159.3473686, name: "Airport"]

    [Landed at the destination]
    Hide mission compass

    [Passenger unloaded]
    Model: [3d model of a tourist] lat: 21.97870135, lon: -159.3474733


Some kind of Mission system ought to be implemented in FlightGear, and there should be a few default missions, and well as the ability for people to create custom missions and use them within the simulator. This would open up the door to a vast array of possibilities, as well as add a whole new level of immersion and customiation. For example, there could be tutorial missions for new pilots who are still learning the basics, as well as long-haul airline or cargo missions, helicopter rescue missions, aerobatic challenges, airshow missions, combat missions for military aircraft, and so so much more.[4]

On the forum there is a section regarding missions and tutorials. In this section there is a topic where Marius_A showed some time ago his attempts to provide mission framework for FG (see https://forum.flightgear.org/viewtopic.php?f=79&t=31057)[5]

maybe this is also right direction to provide missions/TE (Tactical Engagement) framework to accompany model scenarios mentioned in this thread.[6]

the creation of a mission editor might go a long way in helping the implementation of such a system. The creation of a "mission editor" is something I have been contemplating for a very long time. The ability to add this type of logic and its execution in a location other than fgdata and the AI GUI might prove useful.[7]

A mission generator should be fairly straightforward to write - after all, it's just a number of variables that are populated in a few nested loops - the main challenge is coming up either with a subset of valid values, or a randomization scheme that can do sanity checking for certain values - or your mission may be flying a MED EVAC mission at night time in an ASK13 :D

Stuart also once explored writing a mission generator using the tutorial system - so it's definitely possible, there isn't anything missing at all - it's mainly a matter of finding people interested in this, and willing to acquire the skills to make this happen - even though the latter should be fairly straightforward - we can probably post the main building blocks for something like this within a few weeks, including code snippets for randomizing aircraft, mission, airports etc

So, it's not exactly difficult, but a matter of finding people willing to pursue this - which kinda applies to the whole missions system.

While we do have a number of folks very familiar with Nasal, most of us are busy with other things - that we often consider "more important" (or at least "more interesting") - but the fact that I am posting here demonstrates that I am interested in seeing this materialize eventually - so, if you are sufficiently motivated, we can post a few snippets of code and teach you enough about Nasal to prototype a simple system and grow it over time.[8]


a simple GUI would definitely be possible using Canvas, we once prototyped a simple dialog that would allow MapStructure layer elements/symbols to be freely moved around on a map, e.g. for visually placing missions elements (other aircraft, crash/accident sites, objectives, wild fires etc):

FlightGear Missions and Adventures#Gallery


Likewise, a slider could be used for timeline-based editing, and a treeview control could be used for event/branching-based editing[9]


all this may seem daunting at first - but once you actually start playing with it, you'll see that it's not all that difficult - the main showstopper/challenge that people typically face in situations like these is that they have HUGE expectations and they don't manage to adapt their expectations to their own skills, expertise and the degree of spare time that they're willing to invest. For instance, here's a mission generator script (pseudo code) that only spits out "text missions":[10]

var supported_aircraft = ["bo105", "c130", "r22"];
var supported_airports = ["KLSV", "KLAS", "KRNO"];
var supported_objectives = ["fly to ", "fly over", "land at"];

foreach(var aircraft; supported_aircraft) {
 foreach(var airport; supported_airport) {
  foreach(var  objective; supported_objectives) {
   var mission = sprintf("Mission generated for %s %s %s", aircraft, objective, airport);
 } # foreach objective
 } # foreach airport
} # foreach aircraft

(if I didn't make any typos, you can directly paste this into the Debug/Nasal console and execute the snippet) Depending on your background this may seem too simple at first, or maybe a bit intimidating given those three nested foreach loops - but what it is really doing there is using all sorts of "variables" (aircraft, airport, objective) and creating combinations of all variables to create different missions. Equally, those variables could be randomied - e.g. to pick different groundspeeds, altitudes, time of day etc Such a stub could be easily populated to create real missions using geo.nas helpers. So all the building blocks are there - and we can even walk people through the whole who are completely new to Nasal, or programming altogether - it's mainly a matter of motivation and spare time, not so much skills/expertise - you'll learn along the way. That's how Thorsten created the Advanced Weather system, too. You may want to dabble a bit with the Nasal snippet above - it can easily be extended.[11]


we have previously talked about coming up with a simple "missions generator" in Nasal space, one where certain aspects of the mission would simply be variables, while other factors may depend on those variables. For instance, let's say we have a simple SAR mission - the mission generator could ask for an airport to be used as the base for the mission:


Next, it could support randomiing the location given a radius around KSFO

30 nm

Next, it could ask for time-of-day to be used:


Next, it could ask for the weather settings:

CAT III As can be seen, this would not need to be very difficult, but there is sufficient room to randomize things using some sane defaults. A while ago, I came up with a simple wizard-like framework that would walk people through creating a custom -set.xml file, the same approach could be used for such a "missions generator": Aircraft Generation Wizard


These days, I would suggest to use a native Canvas UI to do this, because it is much more flexible. At this point, I guess it is more important to gather a team of people who know a little about Nasal coding, so that we can prototype a simple generator.

And as a matter of fact, rleibner's recent work on supporting "AI-ATC" via ground-controlled-approaches (GCA) could be considered the foundation for a multi-variable "mission generator": Howto:Implementing a simple GCA system


As can be seen, this is a simple Canvas GUI dialog, but it takes roughly a 10-12 parameters to configure the GCA, which could be considered "mission variables".

It would be a piece of cake to extend this for other purposes, turn it into an actual wizard and hook it up to some kind of mission/adventure system, possibly in conjunction with the spoken atc addon rleibner is developing: Spoken ATC And actually, once you think about it, using the checklists feature, it would be relatively easy to customize different missions for different aircraft semi-automatically, because the various V-speeds etc are part of the checklist. I guess that's the kind of approach, I'd use to make sure that a single "mission" could be applied to different locations (airports/runways).