# Mission Authoring Fundamentals

# Mission Format

Missions are JSON files. You should use a JSON validator like jsonlint (opens new window) to confirm the file format is valid. Hype Operations Center also contains the Scenario Developer tool which will check formatting as you make changes.

# Development workflow

Mission developers should use Mission Editor -> Scenario Developer in Hype Operations Center. Clicking Connect to Mission Editor on PC and then Save to reload the script in the aircraft. Once the aircraft is connected, Save will reload the mission automatically.

The mission may be tested in whole or part in HOC, and then eventually saved to a simple .json file for distribution to end users. Using the editor will bypass the mission index.

# Mission Metadata Sections

Section Description
title Text for the user to identify the mission.
id id is used to switch to the mission using load_mission API. Must be unique.
start_info Determines start positions on the map.
briefing Configure information for the user to see when the mission starts.
aircraft Optional. If present, specifies an array of supported aircraft. ["H145"]
applicable Optional. If presnet, specifies an array of supported variants. ["CIVILCARGO", "MILITARYCARGO"]
api_version Not checked with v1 missions. All missions are API version 0.1.

# Mission Data Sections

Each of the sections below corresponds to a store for different kinds of data. You can usually define static information up front, or call APIs to create/manipulate/remove data during the mission.

Section Description
locations Locations (lat/lon)
events Events (Event handlers)
objects Objects (live objects)
routes Routes (lists of locations)
threads Execution threads
stringTokens Replace one string with another
userActions Commands available for the user to interact with
icons data-uri's representing 44x44 PNG images for use on the map
macros Functions the mission may use (reusable code)
data Static data

# Mission execution overview

A mission is essentially a computer program. Missions are made up of sets of commands which can work with data within the simulator and on the network.

An extremely simple mission looks like this:

{
  "title": "My simple mission",
  "objectives": [
    {
      "title": "Done",
      "commands": [
        {"sleep": "forever"}
      ]
    }
  ]
}
  • title: The mission title is used by the user to identify it in lists and to select it from the mission library.
  • objectives: Objectives simply contain another title (the objective to display at the bottom of the mission app) and commands (a COMMANDLIST) which will automatically run when the mission starts.

This mission contains only one command, {"sleep": "forever"}, which instructs the system to begin waiting and never continue. This COMMAND is what prevents the mission from ending.

# COMMAND

COMMAND is the foundational command in the mission system, executed always in a COMMANDLIST form. QUERY is used very commonly and is a a component of a command but not a command in of itself.

Each of the possible commands are listed in the COMMANDS page. Commands that take a QUERY may use any expression from the QUERY section.

# COMMANDLIST

A COMMANDLIST is a list of commands which execute sequentially, waiting for each command to finish before continuing.

[
  COMMAND1,
  COMMAND2,
  COMMAND3
]

[
  {"set_message":{"text": "hello world}},
  {"sleep": 1},
  {"#comment": "my hello world program"}
]

# QUERY

A QUERY may be composed of other QUERY resulting in an expression that for example fetches a value and adds another value to it.

Each of the below commands are suitable as a QUERY, as well as numbers and strings.

Examples:

1
11.5
{"var":["L:TEST","number"]}
"hello"
{"text": "hello {0}", "params": [ QUERY, ... ]}

# DATAQUERY

A data query is an OSM Overpass API query. Check your queries on Overpass Turbo (opens new window). Optionally queries can be post-processed using logic/groups.

Examples:

“[out:json]; node({{bbox}})[man_made=silo]; out center;”

{
  query:
  "[out:json];(area({{bbox}})[amenity=hospital];area({{bbox}})[aeroway=helipad];); out center;",
  "groups": [
    {amenity: "hospital"},
    {aeroway: "helipad"}
  ],
  logic: {"intersection": 0.2}
}