Project Orbiter Interactive Scenarios

nbcfrosty

Well-known member
Joined
Jun 16, 2023
Messages
182
Reaction score
215
Points
58
Location
US
Hello all. I thought it'd be fun if Orbiter had more interactive content. Like replays, but ones where you can actually do the flying. Where there is more of a directed, progressive, game like feel.

I have a little plugin missions.dll that reads JSON files like this:

Code:
{
    "mission_title": "Get to PB-01",
    "events": [
        {
            "event_title": "Get to pb-01",
            "event_text": "You are there. Press Shift + A in the MFD.",
            "event_action_button_title": "You are there",
            "event_action_button_desc": "You are near the PB-01 click this to submit",
            "event_key": "done",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 15,
                    "max_value": 1600
                },
                {
                    "condition_type": "proximity",
                    "subject": "PB-01",
                    "min_value": 0,
                    "max_value": 10
                }
            ]
        },
        {
            "event_title": "Done",
            "event_text": "Done...",
            "event_set_focus": "PB-01",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "done",
                    "min_value": 3,
                    "max_value": 5
                }
            ]
        }
    ]
}

The following event condition types are currently supported:
Code:
altitude
pitch_angle
bank_angle
yaw_angle
apoapsis
apt
periapsis
pet
eccentricity
angular_speed
mass
velocity
main_engines
hover_engines
retro_engines
heading
focus
proximity
docked
time

Here's an example of a slightly more complex mission file:
Code:
{
    "mission_title": "Ascent",
    "events": [
        {
            "event_title": "Greeting",
            "event_text": "Welcome. You are sitting in Deltaglider GL-01 on KSC runway 33.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 0,
                    "max_value": 1
                }
            ]
        },
        {
            "event_title": "Surface MFD",
            "event_text": "The Surface MFD on your left shows you the ship's attitude and atmospheric parameters.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 5,
                    "max_value": 6
                }
            ]
        },
        {
            "event_title": "Orbit MFD",
            "event_text": "Orbit MFD shows you your ship's orbital trajectory.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 10,
                    "max_value": 11
                }
            ]
        },
        {
            "event_title": "Pre-launch",
            "event_text": "You are now ready to launch. Press CONTROL + PLUS key on your numpad to light your engines!",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 15,
                    "max_value": 1600
                }
            ]
        },
        {
            "event_title": "Launch",
            "event_text": "Great, you are now rolling down the runway.",
            "event_key": "launch",
            "event_conditions": [
                {
                    "condition_type": "main_engines",
                    "min_value": 0.1,
                    "max_value": 2
                },
                {
                    "condition_type": "time",
                    "start_key": "met",
                    "min_value": 20,
                    "max_value": 50
                }
            ]
        },
        {
            "event_title": "Preprare Rotation",
            "event_text": "You are now going at 100 m/s, prepare to rotate.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "launch",
                    "min_value": 5,
                    "max_value": 110
                },
                {
                    "condition_type": "velocity",
                    "min_value": 100,
                    "max_value": 101
                }
            ]
        },
        {
            "event_title": "Rotate",
            "event_text": "Lift off by pressing NUMPAD 2.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "launch",
                    "min_value": 10,
                    "max_value": 111
                },
                {
                    "condition_type": "velocity",
                    "min_value": 150,
                    "max_value": 250
                }
            ]
        },
        {
            "event_title": "Bank Right",
            "event_text": "Start banking right to heading 90 degrees using NUMPAD 6.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "launch",
                    "min_value": 15,
                    "max_value": 300
                },
                {
                    "condition_type": "altitude",
                    "min_value": 1000,
                    "max_value": 5000
                }
            ]
        },
        {
            "event_title": "Leveling out",
            "event_text": "Level out the bank angle with NUMPAD 4.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "launch",
                    "min_value": 20,
                    "max_value": 2001
                },
                {
                    "condition_type": "bank_angle",
                    "min_value": 10,
                    "max_value": 90
                }
            ]
        },
        {
            "event_title": "leveled out",
            "event_text": "You are now flying level.",
            "event_key": "aligned",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "launch",
                    "min_value": 25,
                    "max_value": 2002
                },
                {
                    "condition_type": "bank_angle",
                    "min_value": -5,
                    "max_value": 5
                },
                {
                    "condition_type": "heading",
                    "min_value": 85,
                    "max_value": 95
                }
            ]
        },
        {
            "event_title": "Pitchup",
            "event_text": "Increase pitch angle to 65 degrees using NUMPAD 2 whilst staying level using NUMPAD 4 and NUMPAD 6.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "aligned",
                    "min_value": 5,
                    "max_value": 113
                }
            ]
        },
        {
            "event_title": "pitchup!!",
            "event_text": "Please pitch up using numpad2!!",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "aligned",
                    "min_value": 20,
                    "max_value": 114
                },
                {
                    "condition_type": "pitch_angle",
                    "min_value": 0,
                    "max_value": 10
                }
            ]
        },
        {
            "event_title": "maintain pitch",
            "event_text": "Maintain pitch angle at 65 degrees.",
            "event_key": "pitchup",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "aligned",
                    "min_value": 10,
                    "max_value": 114
                },
                {
                    "condition_type": "pitch_angle",
                    "min_value": 60,
                    "max_value": 68
                }
            ]
        },
        {
            "event_title": "Pitchdown",
            "event_text": "Decrease pitch angle to 45 degrees using NUMPAD 8.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "pitchup",
                    "min_value": 5,
                    "max_value": 115
                },
                {
                    "condition_type": "pitch_angle",
                    "min_value": 60,
                    "max_value": 68
                },
                {
                    "condition_type": "altitude",
                    "min_value": 30000,
                    "max_value": 45000
                }
            ]
        },
        {
            "event_title": "Maintain VS",
            "event_text": "Slowly decrease pitch angle, making sure vertical speed is close to 0 m/s.",
            "event_key": "ballistic",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "pitchup",
                    "min_value": 5,
                    "max_value": 500
                },
                {
                    "condition_type": "pitch_angle",
                    "min_value": 40,
                    "max_value": 70
                },
                {
                    "condition_type": "altitude",
                    "min_value": 70000,
                    "max_value": 100000
                }
            ]
        },
        {
            "event_title": "Check Apogee",
            "event_text": "Check the Apoapsis Altitute (ApA) on the Orbit MFD. It should be around 160 km.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "ballistic",
                    "min_value": 5,
                    "max_value": 3000
                },
                {
                    "condition_type": "apoapsis",
                    "min_value": 140000,
                    "max_value": 160000
                }
            ]
        },
        {
            "event_title": "Approaching MECO",
            "event_text": "Cut off the main engines by pressing NUMPAD * when ApA reads 200 km.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "ballistic",
                    "min_value": 5,
                    "max_value": 3000
                },
                {
                    "condition_type": "apoapsis",
                    "min_value": 160000,
                    "max_value": 400000
                }
            ]
        },
        {
            "event_title": "MECO",
            "event_text": "Main engines cut off. Welcome to space! You are now coasting to apoapsis",
            "event_key": "meco",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "ballistic",
                    "min_value": 5,
                    "max_value": 1180
                },
                {
                    "condition_type": "main_engines",
                    "min_value": 0,
                    "max_value": 0
                }
            ]
        },
        {
            "event_title": "Circularize",
            "event_text": "Prepare to circularize your orbit by burning prograde at apoapsis. Activate prograde autopilot by pressing [ key.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "meco",
                    "min_value": 5,
                    "max_value": 50000
                },
                {
                    "condition_type": "apt",
                    "min_value": 60,
                    "max_value": 70
                }
            ]
        },
        {
            "event_title": "Burn",
            "event_text": "Fire main engines with CONTROL + NUMPAD PLUS until your periapsis is around 200 km and ecc is less than 0.1",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "meco",
                    "min_value": 5,
                    "max_value": 5000
                },
                {
                    "condition_type": "apt",
                    "min_value": 0,
                    "max_value": 5
                }
            ]
        },
        {
            "event_title": "Circularized",
            "event_text": "Congratulations! You have successfully circularized your orbit.",
            "event_conditions": [
                {
                    "condition_type": "time",
                    "start_key": "meco",
                    "min_value": 5,
                    "max_value": 5000
                },
                {
                    "condition_type": "periapsis",
                    "min_value": 200000,
                    "max_value": 600000
                }
            ]
        }
    ]
}

You can create a file in orbiter_root/Config/Missions/ascent.json and use the attached DLL test plugin. Currently plugin will always look for ascent.json.
Just wanted to share. Welcome any ideas.
 

Attachments

  • missions.zip
    138 KB · Views: 3

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,742
Reaction score
2,485
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Sounds like a great idea, at least, it could making scripted missions easier to do than by implementing them in Lua (alone).
 

nbcfrosty

Well-known member
Joined
Jun 16, 2023
Messages
182
Reaction score
215
Points
58
Location
US
Sounds like a great idea, at least, it could making scripted missions easier to do than by implementing them in Lua (alone).

And I am supporting optional execution of lua when event is triggered. There is also a "user action button" that's currently rendered in an MFD that will allow interaction as part of an event condition.
 

nbcfrosty

Well-known member
Joined
Jun 16, 2023
Messages
182
Reaction score
215
Points
58
Location
US
Worked on the script loading semantics. Tried to model systems like Skyrim. I have changed the structure such that "seeder" events are placed in Config\Missions\Quests\Seeders. These events in Seeders folder serve to trigger/start quests basically using event_mission_file. For example:

Code:
{
    "mission_title": "",
    "events": [
        {
            "event_title": "Ascent to Orbit",
            "event_text": "You are going to go to Orbit.",
            "event_mission_file": "Config\\Missions\\Quests\\Tutorials\\ascent.json",
            "event_conditions": [
                {
                    "condition_type": "proximity_ground",
                    "subject": "Earth,-80.682494,28.596794",
                    "min_value": 0,
                    "max_value": 0.1
                }
            ]
        }
    ]
}

If this is placed in a file in the Seeders folder, then anytime the focus vessel is close to the KSC runway 33, the Config\\Missions\\Quests\\Tutorials\\ascent.json quest will become discovered by the user and will become startable. The user can then use the MFD to start the quest.


Condition Types
Conditions define the criteria that need to be met for an event to trigger. Below are the condition types supported by the system:

  • altitude: Checks if the vessel's altitude is within a specific range.
  • pitch_angle: Checks if the vessel's pitch angle is within a specific range.
  • bank_angle: Checks if the vessel's bank angle is within a specific range.
  • yaw_angle: Checks if the vessel's yaw angle is within a specific range.
  • apoapsis: Checks if the vessel's apoapsis altitude is within a specific range.
  • apt: Checks if the vessel's time to apoapsis is within a specific range.
  • periapsis: Checks if the vessel's periapsis altitude is within a specific range.
  • pet: Checks if the vessel's time to periapsis is within a specific range.
  • eccentricity: Checks if the vessel's orbit eccentricity is within a specific range.
  • angular_speed: Checks if the vessel's angular speed is within a specific range.
  • mass: Checks if the vessel's mass is within a specific range.
  • velocity: Checks if the vessel's velocity is within a specific range.
  • main_engines: Checks if the vessel's main engine throttle level is within a specific range.
  • hover_engines: Checks if the vessel's hover engine throttle level is within a specific range.
  • retro_engines: Checks if the vessel's retro engine throttle level is within a specific range.
  • heading: Checks if the vessel's heading is within a specific range.
  • focus: Checks if the focus object matches a specified vessel name.
  • proximity: Checks if the specified vessel is within a certain distance from the focus object.
  • proximity_ground: Checks if the specified ground location is within a certain distance from the focus object.
  • docked: Checks if the vessel is docked with the specified vessel.
  • time: Evaluates the mission's elapsed time (MET) or time relative to a specified event key.

Event Actions
Event actions specify what happens when an event is triggered. The supported actions include:

  • set_focus: Sets the focus to a specified vessel.
  • execute_lua: Runs a Lua script.
  • start_scenario: Restarts the Orbiter simulator with a specified scenario file.
  • load_mission: Loads another mission file.
  • camera_sequence: Executes a camera sequence with specific parameters:
  • azim0: Initial azimuth angle.
  • phi0: Initial polar angle.
  • reldist: Initial relative distance.
  • dtazim: Change in azimuth angle per second.
  • dtphi: Change in polar angle per second.
  • dtdist: Change in distance per second.
  • duration: Duration of the sequence.

  • camera_ground_sequence: Executes a ground camera sequence with specific parameters:
  • reference: Reference object for the camera.
  • azim0: Initial azimuth angle.
  • phi0: Initial polar angle.
  • lng: Longitude of the camera.
  • lat: Latitude of the camera.
  • alt: Altitude of the camera.
  • dtazim: Change in azimuth angle per second.
  • dtphi: Change in polar angle per second.
  • dtlng: Change in longitude per second.
  • dtlat: Change in latitude per second.
  • duration: Duration of the sequence.

  • flyby: Executes a flyby maneuver with specific parameters:
  • reference: Reference object for the flyby.
  • pos0: Initial position.
  • vel: Velocity vector.
  • duration: Duration of the flyby.

  • sound_loop: Plays a looping sound file.
  • sound_play: Plays a sound file once.
  • sound_stop: Stops a sound file if it is playing.
 
Top