Board index FlightGear Development Tutorials and missions

Stand-alone mission system

Interactive in-sim tutorials and missions

Stand-alone mission system

Postby Marius_A » Tue Nov 22, 2016 10:04 pm

I am experimenting with "FSX style" mission system. It is a stand-alone Nasal module that is compatible with tutorials system.

Current results:


The following mission.xml file structure was used to create this mission:
Code: Select all
<?xml version="1.0"?>
<PropertyList>

   <presets>
      <airport-id>KLVK</airport-id>
      <altitude>-9999</altitude>
      <altitude-ft>-9999</altitude-ft>
      <latitude-deg>-9999</latitude-deg>
      <longitude-deg>-9999</longitude-deg>
   </presets>

   <timeofday>noon</timeofday>

   <object>
      <name>Timer 1</name>
      <type>timer-trigger</type>
      <activated>1</activated>
      <single-shot>1</single-shot>
      <stop-time>5.0</stop-time>
      <actions>
         <object-reference>Intro 1</object-reference>
         <object-reference>Timer 2</object-reference>
      </actions>
   </object>

   <object>
      <name>Timer 2</name>
      <type>timer-trigger</type>
      <activated>0</activated>
      <single-shot>1</single-shot>
      <stop-time>4.0</stop-time>
      <actions>
         <object-reference>Intro 2</object-reference>
         <object-reference>Timer 3</object-reference>
         <object-reference>Show_all_hoops</object-reference>
      </actions>
   </object>

   <object>
      <name>Timer 3</name>
      <type>timer-trigger</type>
      <activated>0</activated>
      <single-shot>1</single-shot>
      <stop-time>3.0</stop-time>
      <actions>
         <object-reference>Intro 3</object-reference>
         <object-reference>Proximity_Hoop1</object-reference>
      </actions>
   </object>

   <object>
      <name>Timer 4</name>
      <type>timer-trigger</type>
      <activated>0</activated>
      <single-shot>1</single-shot>
      <stop-time>2.0</stop-time>
      <actions>
         <object-reference>End 1</object-reference>
      </actions>
   </object>

   <object>
      <name>Timer_Onscreen</name>
      <type>timer-trigger</type>
      <activated>0</activated>
      <single-shot>1</single-shot>
      <on-screen-timer>1</on-screen-timer>
      <stop-time>10000.0</stop-time>
   </object>

   <object>
      <name>Intro 1</name>
      <type>dialog-action</type>
      <text>Welcome to the FlightGear flight simulator!</text>
      <sound-file>Welcome.wav</sound-file>
      <delay-sec>3</delay-sec>
   </object>

   <object>
      <name>Intro 2</name>
      <type>dialog-action</type>
      <text>This is the test mission.</text>
      <sound-file>msg1.wav</sound-file>
      <delay-sec>2</delay-sec>
   </object>

   <object>
      <name>Intro 3</name>
      <type>dialog-action</type>
      <text>Fly through all the hoops.</text>
      <sound-file>msg2.wav</sound-file>
      <delay-sec>2</delay-sec>
   </object>

   <object>
      <name>End 1</name>
      <type>dialog-action</type>
      <text>Congratulations! You have completed your first mission.</text>
      <sound-file>msg4a.wav</sound-file>
      <delay-sec>3</delay-sec>
   </object>

   <object>
      <name>SHOW_Onscreen_timer</name>
      <type>object-activation-action</type>
      <object-state>1</object-state>
      <reference-list>
         <object-reference>Timer_Onscreen</object-reference>
      </reference-list>
   </object>
   <object>
      <name>HIDE_Onscreen_timer</name>
      <type>object-activation-action</type>
      <object-state>0</object-state>
      <reference-list>
         <object-reference>Timer_Onscreen</object-reference>
      </reference-list>
   </object>

   <object>
      <name>Show_all_hoops</name>
      <type>object-activation-action</type>
      <object-state>1</object-state>
      <reference-list>
         <object-reference>Hoop1_active</object-reference>
         <object-reference>Hoop2_inactive</object-reference>
         <object-reference>POI_hoop1</object-reference>
      </reference-list>
   </object>

   <object>
      <name>SHOW_Hoop1_active</name>
      <type>object-activation-action</type>
      <object-state>1</object-state>
      <reference-list>
         <object-reference>Hoop1_active</object-reference>
         <object-reference>Proximity_Hoop1</object-reference>
         <object-reference>POI_hoop1</object-reference>
      </reference-list>
   </object>
   <object>
      <name>HIDE_Hoop1_active</name>
      <type>object-activation-action</type>
      <object-state>0</object-state>
      <reference-list>
         <object-reference>Hoop1_active</object-reference>
         <object-reference>Proximity_Hoop1</object-reference>
         <object-reference>POI_hoop1</object-reference>
      </reference-list>
   </object>
   <object>
      <name>HIDE_Hoop1_inactive</name>
      <type>object-activation-action</type>
      <object-state>0</object-state>
      <reference-list>
         <object-reference>Hoop1_inactive</object-reference>
      </reference-list>
   </object>
   <object>
      <name>HIDE_Hoop2_active</name>
      <type>object-activation-action</type>
      <object-state>0</object-state>
      <reference-list>
         <object-reference>Hoop2_active</object-reference>
         <object-reference>Proximity_Hoop2</object-reference>
         <object-reference>POI_hoop2</object-reference>
      </reference-list>
   </object>
   <object>
      <name>HIDE_Hoop2_inactive</name>
      <type>object-activation-action</type>
      <object-state>0</object-state>
      <reference-list>
         <object-reference>Hoop2_inactive</object-reference>
      </reference-list>
   </object>
   <object>
      <name>SHOW_Hoop2_active</name>
      <type>object-activation-action</type>
      <object-state>1</object-state>
      <reference-list>
         <object-reference>Hoop2_active</object-reference>
         <object-reference>Proximity_Hoop2</object-reference>
         <object-reference>SHOW_Onscreen_timer</object-reference>
         <object-reference>POI_hoop2</object-reference>
      </reference-list>
   </object>

   <object>
      <name>Proximity_Hoop1</name>
      <type>proximity-trigger</type>
      <activated>0</activated>
      <on-enter-actions>
         <object-reference>SingleShot_Hoop_SFX</object-reference>
         <object-reference>HIDE_Hoop1_active</object-reference>
         <object-reference>Hoop1_inactive</object-reference>
         <object-reference>HIDE_Hoop2_inactive</object-reference>
         <object-reference>SHOW_Hoop2_active</object-reference>
      </on-enter-actions>
      <areas>
         <object-reference>Area_Hoop1</object-reference>
      </areas>
   </object>
   <object>
      <name>Proximity_Hoop2</name>
      <type>proximity-trigger</type>
      <activated>0</activated>
      <on-enter-actions>
         <object-reference>SingleShot_Hoop_SFX</object-reference>
         <object-reference>HIDE_Hoop2_active</object-reference>
         <object-reference>Hoop2_inactive</object-reference>
         <object-reference>HIDE_Hoop1_inactive</object-reference>
         <object-reference>SHOW_Hoop1_active</object-reference>
         <object-reference>HIDE_Onscreen_timer</object-reference>
         <object-reference>Timer 4</object-reference>
      </on-enter-actions>
      <areas>
         <object-reference>Area_Hoop2</object-reference>
      </areas>
   </object>

   <object>
      <name>Area_Hoop1</name>
      <type>rectangle-area</type>
      <width>100.0</width>
      <height>100.0</height>
      <length>25.0</length>
      <orientation>
         <heading-deg>88.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <attached-world-position>
         <latitude-deg>37.69387904</latitude-deg>
         <longitude-deg>-121.8223982</longitude-deg>
         <altitude-m>213.8884859</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </attached-world-position>
   </object>
   <object>
      <name>Area_Hoop2</name>
      <type>rectangle-area</type>
      <width>100.0</width>
      <height>100.0</height>
      <length>25.0</length>
      <orientation>
         <heading-deg>56.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <attached-world-position>
         <latitude-deg>37.6936749</latitude-deg>
         <longitude-deg>-121.8302028</longitude-deg>
         <altitude-m>245.7999165</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </attached-world-position>
   </object>

   <object>
      <name>Hoop1_active</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/hoop-40x40.xml</path>
      <orientation>
         <heading-deg>88.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.69387904</latitude-deg>
         <longitude-deg>-121.8223982</longitude-deg>
         <altitude-m>213.8884859</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>
   <object>
      <name>Hoop1_active</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/Numbers/num_1.xml</path>
      <orientation>
         <heading-deg>88.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.69387904</latitude-deg>
         <longitude-deg>-121.8223982</longitude-deg>
         <altitude-m>213.8884859</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>
   <object>
      <name>Hoop1_inactive</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/hoop-100x100-red.xml</path>
      <orientation>
         <heading-deg>88.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.69387904</latitude-deg>
         <longitude-deg>-121.8223982</longitude-deg>
         <altitude-m>213.8884859</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>

   <object>
      <name>Hoop2_active</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/hoop-40x40.xml</path>
      <orientation>
         <heading-deg>56.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.6936749</latitude-deg>
         <longitude-deg>-121.8302028</longitude-deg>
         <altitude-m>245.7999165</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>
   <object>
      <name>Hoop2_active</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/Numbers/num_2.xml</path>
      <orientation>
         <heading-deg>56.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.6936749</latitude-deg>
         <longitude-deg>-121.8302028</longitude-deg>
         <altitude-m>245.7999165</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>
   <object>
      <name>Hoop2_inactive</name>
      <type>model</type>
      <activated>0</activated>
      <path>Missions/Generic/Models/hoop-100x100-red.xml</path>
      <orientation>
         <heading-deg>56.0</heading-deg>
         <pitch-deg>0.0</pitch-deg>
         <roll-deg>0.0</roll-deg>
      </orientation>
      <world-position>
         <latitude-deg>37.6936749</latitude-deg>
         <longitude-deg>-121.8302028</longitude-deg>
         <altitude-m>245.7999165</altitude-m>
         <altitude-is-AGL>0</altitude-is-AGL>
      </world-position>
   </object>

   <object>
      <name>SingleShot_Hoop_SFX</name>
      <type>single-shot-sound-action</type>
      <sound-file>glassbell.wav</sound-file>
   </object>

   <object>
      <name>POI_hoop1</name>
      <type>point-of-interest</type>
      <activated>0</activated>
      <target-name>Gate 1</target-name>
      <attached-world-object>
         <object-reference>Hoop1_active</object-reference>
         <x-offset-m>0.0</x-offset-m>
         <y-offset-m>0.0</y-offset-m>
         <z-offset-m>70.0</z-offset-m>
      </attached-world-object>
   </object>

   <object>
      <name>POI_hoop2</name>
      <type>point-of-interest</type>
      <activated>0</activated>
      <target-name>Gate 2</target-name>
      <attached-world-object>
         <object-reference>Hoop2_active</object-reference>
         <x-offset-m>0.0</x-offset-m>
         <y-offset-m>0.0</y-offset-m>
         <z-offset-m>70.0</z-offset-m>
      </attached-world-object>
   </object>

</PropertyList>



Each mission is contained in its own directory. Directory structure:
Code: Select all
Models/
Sounds/
Nasal/
image.png
metadata.xml
mission.xml
Marius_A
 
Posts: 92
Joined: Wed Dec 04, 2013 3:20 pm

Re: Stand-alone mission system

Postby PINTO » Tue Nov 22, 2016 10:31 pm

...inb4 hooray links to the wiki...

Looks really really good! ETA on releasable version?
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10

Re: Stand-alone mission system

Postby Hooray » Tue Nov 29, 2016 8:35 pm

My suggestion would be to add this to the wiki and document the system accordingly - we've toyed with a handful of different approaches, but so far most things we've seen are much more experimental (read:RFC) than what you seem to have already. As a matter of fact, I once tinkered with an XML-extensible system where new tags could be directly implemented by specifying them in the form of Nasal callbacks - this was rather flexible actually, i.e. I documented the approach at: http://wiki.flightgear.org/FlightGear_M ... _Framework

The idea was to re-implement tutorial.nas by turning each existing "tutorial tag" (=directive) into such a declarative form, so that the whole system would become more easily extensible - including specifically for supporting missions (or even bombable-like scenarios).

This would also make it possible to support versioning in a sane fashion, as well as inter-module dependencies and even "online" updates
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

Re: Stand-alone mission system

Postby Johan G » Fri Dec 02, 2016 3:24 pm

@ Marius_A: This looks rather similar to some of your earlier work. Nice to see that something is still happening on that front.

Some more or less related topics:

Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Stand-alone mission system

Postby Marius_A » Sun Oct 22, 2017 8:57 pm

Racing mode:

After flying through each race point, time-penalty points will be calculated according to user defined conditions.
Marius_A
 
Posts: 92
Joined: Wed Dec 04, 2013 3:20 pm

Re: Stand-alone mission system

Postby Hooray » Tue Oct 24, 2017 6:48 pm

That's pretty cool, you may want to add the video to the next newsletter.
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

Re: Stand-alone mission system

Postby Catalanoic » Tue Oct 24, 2017 10:01 pm

wow burning my MSFS X discs in 3 .2 .1. ...
i need to definetly explore that mission scenarios and try to do adapt on more sceneries, looks like FG is OK for "game" purposes without leaving simulation.
User avatar
Catalanoic
 
Posts: 1099
Joined: Mon Mar 05, 2012 1:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2017.3
OS: Lubuntu/Windows 7

Re: Stand-alone mission system

Postby wkitty42 » Wed Oct 25, 2017 12:46 am

hehehe, i've said, numerous times, that a simulator is not a game but games can be played in simulators ;) flightgear is definitely a simulator...
"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
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04


Return to Tutorials and missions

Who is online

Users browsing this forum: No registered users and 1 guest