Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World

View project on GitHub

1. MOOSE framework

MOOSE is a Mission Object Oriented Scripting Environment, and is meant for mission designers and mission hosters. It allows to quickly setup complex missions using pre-scripted scenarios using the available classes within the MOOSE Framework. MOOSE works with DCS world 1.5. and 2.0.

MOOSE Banner

MOOSE framework goal

The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. The MOOSE is a service that is produced while being consumed … , it will evolve further as more classes are developed for the framework, and as more users are using it.

MOOSE is NOT meant to be a one-man show, it is meant to evolve within a growing community around the framework.

Within the community, key users will start supporting, documenting, explaining and even creating new classes for the framework. It is the ambition to grow this framework as a de-facto standard for mission designers to use.

2. MOOSE Framework

The following classes are currently embedded within MOOSE framework and can be included within your mission scripts:

MOOSE is an Object Oriented framework and defines Classes, which are components that combine Methods and Variables/Properties as one encapsulated structure (table). Mission Designers can what we call Instantiate Objects from these MOOSE classes.

An example of what this means is shortly explained using the SPAWN class of MOOSE, which you can use to spawn new groups into your running mission. The SPAWN class simplifies the process of spawning, and it has many methods that you can use to create variations how you want your spawn object to spawn new groups.

local SpawnObject = SPAWN:New( "GroupName" ) -- This creates a new SpawnObject from the SPAWN class, using the :New method constructor to instantiate a new SPAWN object searching for the GroupName as the late activated group defined within your Mission Editor.  
-- Nothing is spawned yet..., so let's use now the SpawnObject to spawn a new GROUP.

local SpawnGroup = SpawnObject:Spawn() -- Here we use the :Spawn() method of the SPAWN class. This method creates a new group from the GroupName template as defined within the Mission Editor.

MOOSE Classes derive or inherit from each other, that means, within MOOSE there is an Inheritance structure where inherited MOOSE Classes are re-using properties and methods from the Parent MOOSE Class. This powerful concept is used everywhere within the MOOSE framework. The main (Parent) Class in the MOOSE framework is the BASE class. Every MOOSE Class is derived from this top BASE Class. So is also the SPAWN class derived from the BASE class. The BASE class provides powerful methods for debugging, event handling and implements the class handling logic. As a normal MOOSE user, you won’t implement any code using inheritance but just know that the inheritance structure is omni present in the intellisense and documentation. You’ll need to browse to the right MOOSE Class within the inheritance tree structure to identify which methods are properties are defined for which class.

MOOSE framework

MOOSE Demonstration Missions

The framework comes with demonstration missions which can be downloaded here, that you can try out and helps you to code.
These missions provide examples of defined use cases how the MOOSE framework can be utilized. Each test mission is located in a separate directory, which contains at least one .lua file and .miz file. The .lua file contains the mission script file that shows how the use case was implemented. You can copy/paste code the code snippets from this .lua file into your missions, as it will accellerate your mission developments. You will learn, see, and understand how the different MOOSE classes need to be applied, and how you can create more complex mission scenarios by combining these MOOSE classes into a complex but powerful mission engine.

Some of these exact test missions are also demonstrated in a video format on the YouTube channel.

2.1. MOOSE Human Tasking Classes

MOOSE Tasking Classes provide a comprehensive Mission Orchestration System. Through COMMANDCENTERs, multiple logical MISSIONs can be orchestrated for coalitions. Within each MISSION, various TASKs can be defined. Each TASK has a TASK ACTION flow, which is the flow that a player (hosted by a UNIT) within the simulator needs to follow and accomplish.

  • COMMANDCENTER: Orchestrates various logical MISSIONs for a coalition.

  • MISSION: Each MISSION has various TASKs to be executed and accomplished by players.

  • TASK_A2A_DISPATCHER: Automatically and dynamically dispatch A2A tasks to be executed by human players, as a result of the detection of airborne targets within a Mission scope.

  • TASK_A2G_DISPATCHER: Automatically and dynamically dispatch A2G tasks to be executed by human players, as a result of the detection of ground targets within a Mission scope.

  • TASK_A2A: Models a A2A CAP, INTERCEPT and SWEEP tasks where a Player is routed towards an attack zone without enemies nearby, and various ground targets need to be eliminated.

  • TASK_A2G: Models a A2G SEAD, CAS and BAI tasks where a Player is routed towards an attack zone with enemies nearby, and various ground targets need to be eliminated.

2.2. MOOSE AI Controlling Classes

MOOSE AI Controlling Classes provide mechanisms to control AI over long lasting processes.
These AI Controlling Classes are based on FSM (Finite State Machine) Classes, and provided an encapsulated way to make AI behave or execute an activity.

  • AI A2A Defenses: Create automatic A2A defense systems executed by AI and perform CAP or GCI.
    • AI_A2A_GCICAP: Using an easy process you can define an A2A defense system using the Mission Editor.
    • AI_A2A_DISPATCHER: Same as AI_A2A_GCICAP, but is for more advanced or developer type mission designers. This class provides more options.
  • AI_BALANCER: Compensate in a multi player mission the abscence of players with dynamically spawned AI air units. When players join CLIENTS, the AI will either be destroyed, or will fly back to the home or nearest friendly airbase.

  • AI_PATROL_ZONE: Make an alive AI Group patrol a zone derived from the ZONE_BASE class. Manage out-of-fuel events and set altitude and speed ranges for the patrol.

  • AI_CAP: Make an alive AI Group perform Combat Air Patrol as a dynamic process.

  • AI_CAS: Make an alive AI Group perform Close Air Support as a dynamic process.

  • AI_BAI: Make an alive AI Group perform Battlefield Air Interdiction as a dynamic process.

2.3. MOOSE Functional Classes

MOOSE Functional Classes provide various functions that are useful in mission design.

  • SPAWN: Spawn new groups (and units) during mission execution.

  • ESCORT: Makes groups consisting of helicopters, airplanes, ground troops or ships within a mission joining your flight. You can control these groups through the ratio menu during your flight. Available commands are around: Navigation, Position Hold, Reporting (Target Detection), Attacking, Assisted Attacks, ROE, Evasion, Mission Execution and more …

  • MISSILETRAINER: Missile trainer, it destroys missiles when they are within a certain range of player airplanes, displays tracking and alert messages of missile launches; approach; destruction, and configure with radio menu commands. Various APIs available to configure the trainer.

  • DETECTION: Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built.

  • SCORING: Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites.

  • SEAD: Make SAM sites avoid SEAD missiles being fired at.

  • DESIGNATE: Make AI automatically designate detected targets, and provide menu options for players to give instructions to the AI how to designate (by laser, smoke or illumination).

  • AIRBASEPOLICE: Control the speed of players at the airbases. Speeding players are eliminated (does not work due to a bug in the DCS).

  • CLEANUP_AIRBASE: Keeps the airbases clean from clutter. (Only partly functional due to a bug in DCS, destroyed objects cannot be removed).

  • RAT: Random Air Traffic engine developed by FunkyFranky, use the available airspace!

2.4. MOOSE Wrapper Classes

MOOSE Wrapper Classes provide an object oriented hierarchical mechanism to manage the DCS objects within the simulator. Wrapper classes provide another easier mechanism to control Groups, Units, Statics, Airbases and other objects.

  • OBJECT: This class provides the base for MOOSE objects.

  • IDENTIFIABLE: This class provides the base for MOOSE identifiable objects, which is every object within the simulator :-).

  • POSITIONABLE: This class provides the base for MOOSE positionable objects. These are AIRBASEs, STATICs, GROUPs, UNITs …

  • CONTROLLABLE: This class provides the base for MOOSE controllable objects. These are GROUPs, UNITs, CLIENTs.

  • AIRBASE: This class wraps a DCS Airbase object within the simulator.

  • GROUP: This class wraps a DCS Group objects within the simulator.

  • UNIT: This class wraps a DCS Unit object within the simulator.

  • CLIENT: This class wraps a DCS Unit object within the simulator, which has a skill Client or Player.

  • STATIC: This class wraps a DCS StaticObject object within the simulator.

2.5. MOOSE Core Classes

These classes define the base building blocks of the MOOSE framework. These classes are heavily used within the MOOSE framework.

  • BASE: The main class from which all MOOSE classes are derived from. The BASE class contains essential functions to support inheritance and MOOSE object execution tracing (logging within the DCS.log file in the saved games folder of the user).

  • DATABASE: Creates a collection of GROUPS[], UNITS[], CLIENTS[] and managed these sets automatically. Provides an API set to retrieve a GROUP, UNIT or CLIENT instance from the _DATABASE object using defined APIs. The collections are maintained dynamically during the execution of the mission, so when players join, leave, when units are created or destroyed, the collections are dynamically updated.

  • EVENT: Provides the Event Dispatcher base class to handle DCS Events, being fired upon registered events within the DCS simulator. Note that EVENT is used by BASE, exposing OnEvent() methods to catch these DCS events.

  • SCHEDULER: This class implements a timer scheduler that will call at optional specified intervals repeatedly or just one time a scheduled function.

  • Finite State Machines: Finite State Machine provides a process management or state machine capability for various scenarios.
  • FSM: The main FSM class can be used to build a generic Finite State Machine.
  • FSM_CONTROLLABLE: An FSM class to control a Controllable. A controllable is a group or unit that can be controlled.

  • MENU: Set Menu options under the radio menu (F10). MENU classes also manage the recursive removal of menus, and the intelligent refresh of menu options (only the changes are applied).
  • MENU_MISSION: Set a main menu structure for the complete mission, for all players.
  • MENU_MISSION_COMMAND: Set a main menu command for the complete mission, for all players.
  • MENU_COALITION: Set a menu structure for a coalition, for all players of that coalition.
  • MENU_COALITION_COMMAND: Set a menu command for a coalition, for all players of that coalition.
  • MENU_GROUP: Set a menu structure for a group, for all players of that group.
  • MENU_GROUP_COMMAND: Set a menu command for a group, for all players of that group.

  • SET: Create SETs of MOOSE objects. The SET can be filtered with defined filter criteria. Iterators are available that iterate through the SET, calling a function for each object within the SET.
  • SET_GROUP: Create a SET of GROUP objects.
  • SET_UNIT: Create a SET of UNIT objects.
  • SET_CLIENT: Create a SET of CLIENT objects.
  • SET_AIRBASE: Create a SET of AIRBASE objects.
  • SET_CARGO: Create a SET of CARGO objects.

  • MESSAGE: A message publishing system, displaying messages to Clients, Coalitions or All players.

  • COORDINATE: Manage 2D and 3D points in the simulation space, and use its methods for various actions on the coordinate.
  • POINT_VEC2: Manage 2D points in the simulation space.
  • POINT_VEC3: Manage 3D points in the simulation space.

  • ZONES: Create a zone object from a trigger zone as defined in the Mission Editor.
  • ZONE_POLYGON: Create a zone object from a group object, which is late activated, and its route points define the zone.
  • ZONE_RADIUS: Create a zone object from a 2D vector on the battlefield, with a defined radius.
  • ZONE_UNIT: Create a zone object around a unit on the battlefield, with a defined radius. This, this zone is a moving zone!
  • ZONE_GROUP: Create a zone object around a group on the battlefield, with a defined radius. The first object in the group has the zone, and is thus a moving zone!

  • CARGO: Manage Cargo in the simulation.
  • CARGO_GROUP: Manage Cargo that is defined as a GROUP object within the simulation.

  • SPAWNSTATIC: Spawn Static objects using a predefined “template”.

  • BEACON: Create beacons.
  • RADIO: Create radio communication.

3. MOOSE usage

The delivery of MOOSE follows a structured release process. Over time, new features are added that can be used in your mission.

The latest release of MOOSE can be downloaded here.

There are 3 different ways how you can use MOOSE, each with a different engagement and complexity level:

3.1. Use MOOSE as a Mission Designer

Refer to the detailed Usage Guide for more information.

3.2. Beta test MOOSE

Beta testers of MOOSE are requested to install additional software.

As a return or as a reward, testers get:

  • Newly developed features planned for the next MOOSE release can be tested and incorporated in your missions early.
  • You can evaluate and contribute to the stability of the next release.
  • Your mission creation workflow becomes very flexible. New features are dynamically added to you missions.

Please read the detailed Beta Test Guide for more information.

3.3. Contribute on the MOOSE development

Those people who have experience in lua development or are excited to contribute to the MOOSE project are welcome.

Please consult the Contribution Guide for more information.

4. MOOSE Support Channels

MOOSE is broadcasted, documented and supported through various social media channels.

Click here for the communities guide of the MOOSE framework.

5. Credits

Note that most of the framework is based on code i’ve written myself, but some code of it is also based on code that i’ve seen as great scripting code and ideas, and which has been revised and/or reworked to fit into the MOOSE framework. I see this framework evolving towards a broader public, and the ownership may dissapear (or parts of it). Consider this code public domain. Therefore a list of credits to all who have or are contributing (this list will increase over time).

You’ll notice that within this framework, there are functions used from mist. I’ve taken the liberty to copy those atomic mist functions that are very nice and useful, and used those.

Greyecho Contributed the devevelopment of the new release system, and the development of the RADIO and BEACON functionalities. We’ll see more appearing from him.

Prof_hilactic SEAD Defenses. I’ve taken the script, and reworded it to fit within MOOSE. The script within MOOSE is hardly recognizable anymore from the original. Find here the posts:…59&postcount=1

xcom His contribution is related to the Event logging system. I’ve analyzed and studied his scripts, and reworked it a bit to use it also within the framework (I’ve also tweaked it a bit). Find his post here:…73&postcount=1

Dutch_Baron (James) Working together with James has resulted in the creation of the AIBALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)

Stuka (Danny) Working together with Danny has resulted in the MISSILETRAINER class. Stuka has shared his ideas and together we made a design. Together with the 476 virtual team, we tested this CLASS, and got much positive feedback!

Mechanic (Gabor) Worked together with Gabor to create the concept of the DETECTION and FAC classes. Mechanic shared his ideas and concepts to group detected targets into sets within detection zones… Will continue to work with G�bor to workout the DETECTION and FAC classes.

Shadoh Interacted on the eagle dynamics forum to build the FOLLOW class to build large WWII airplane formations.

Grimes Without the effort of Grimes with MIST and his continuous documentation of the DCS API, the development of MOOSE would not have been possible.
MOOSE is complementary to MIST, so if you use MIST in parallel with MOOSE objects, this should work.
The documentation of the [DCS API] is the work of Grimes. Please consult his documentation in case of any question concerning the DCS API level.

For the rest I also would like to thank the numerous feedback and help and assistance of the moose community at SLACK.COM. Note that there is a vast amount of other scripts out there. I may contact you personally to ask for your contribution / permission if i can use your idea or script to tweak it to the framework. Parts of these scripts will have to be redesigned to fit it into an OO framework.

The rest of the framework functions and class definitions were my own developments, especially the core of MOOSE. Trust I’ve spent hours and hours investigating, trying and writing and documenting code building this framework. Hope you think the idea is great and useful.

Thank you! FC