MODEL BEHAVIORS
A major part of setting up any SimObject within Microsoft Flight Simulator 2024 is controlling the way the different components of the model will behave under specific circumstances. This is made possible by using components within the <CompileBehaviors> element of the [model].xml and you can control these components in one of two ways:
- Using Simulation Variables (SimVars)
- Using code (RPN - Reverse Polish Notation)
In general you would create a series of components that use one of the above methods to get information that will then influence the behavior of the model in the simulation, and each component would be assigned to a specific node and/or animation.
Another feature of model behaviors is that you can use templates that have been pre-created for you or that you have created yourself. This system means that you can call templates with default values for things like landing gear, switches, etc... You can then override any (or all) of the default values when required for any particular model, saving you time having to re-create the same section of XML multiple times for different projects.
IMPORTANT: Incorrectly using the template system may mean you overwrite default Microsoft Flight Simulator 2024 templates, due to the way The Virtual File System works. This will impact all Sim Objects using that template, so extreme care should be taken when creating/editing templates. We recommend that instead of overwriting the default templates, you instead COPY the ones you want to modify and give them a new name, instead of editing either the base files or overriding them in your package using the same template names.
Below you can find in-depth information about the different XML elements used for creating components and templates as well as how to use them:
- General Template XML Properties
- Program Template XML Properties
- Update Frequency Preset XML Properties
- Input Event XML Properties
- Important Templates
There are also some simple tutorial pages that explain the template system and how to use it in a bit more detail:
- Using Model Behaviors
- Model Behaviors Component Overview
- Model Behaviors Parameters
- Model Behaviors Inputs
- Templates
- Default Templates
- Custom Templates
- Debugging Model Behaviors
You can find all the available pre-created templates from the following SDK folder:
C:\MSFS 2024 SDK\ModelBehaviorDefs\Asobo_EX1
IMPORTANT: All the core behaviour files for Microsoft Flight Simulator 2024 are in the Asobo_EX1 folder. The core files for Microsoft Flight Simulator 2020 are in the Asobo folder. You should not mix and match templates from both folders. They may work together, but future updates may break this and in general all aircraft for MSFS 2024 should use the Asobo_EX1 templates. Using the Asobo_EX1 templates also requires that the <CompileBehaviors>, <ModelBehaviors>, and <Behaviors> tags all must be set to version 2.
The documentation also has an interactive Template Explorer which can be accessed here:
Including Template Files
When using the templates included with the SDK there are some things to note:
- You should be using the
ModelBehaviorFileattribute of the<Include>element to include the file in the definitions. This will automatically resolve to the default SDK install location, eg:<Include ModelBehaviorFile="Asobo_EX1\Common\Exterior\Templates\SubTemplates\Landing_SubTemplates.xml" /> - If you are not using compiled behaviors (see
<CompileBehaviors>for more information), then once the package is built theModelBehaviorFilepath will instead resolve to the streamed templates folder within the simulation packages. - If you are using compiled behaviors, the necessary templates will be compiled into the package and the
ModelBehaviorFilepath will resolve to use them.
Using Input Events
Finally, model behaviors are also used to define Input Events. These are events that are triggered by some interaction between the user and an aircraft cockpit control, like a lever or a button. The input events are used to change or set a value corresponding to the control being used, using the SimVar associated with the control and RPN to modify the value. The XML contents for these events are described in full in the following section:
There is also a tutorial on creating Input Event interactions here:
It is worth noting that the Input Events can also be used to intercept and override some of the general simulation key events, by binding Event IDs to an input event <Preset>. This is explained in the following section:
Behavior Version Improvements
In Microsoft Flight Simulator 2024 the <CompileBehaviors> , <Behaviors>, and <ModelBehaviors> elements at the top level of the model XML file have a version attribute which can be used to modify how behaviors work in some important ways. Essentially, any value greater than 1 will use all the MSFS 2024 features, while a value of 1 will be more like the MSFS 2020 feature set. Specifically, for any version greater than 1:
-
The
<IncludeBase>element has been fixed to correctly reference sub-folders when used within files in sub-folders. For example, previously it worked like this (and with a behavior version of 1 it will still work like this):<!-- in BaseFolder --> <IncludeBase RelativeFile="SubFolder/A.xml"/> <!-- in BaseFolder/SubFolder --> <IncludeBase RelativeFile="B.xml"/><!-- includes BaseFolder/B.xml -->However now it works more like this:
<!-- in BaseFolder --> <IncludeBase RelativeFile="SubFolder/A.xml"/> <!-- in BaseFolder/SubFolder --> <IncludeBase RelativeFile="B.xml"/><!-- includes BaseFolder/SubFolder/B.xml -->
-
The
<SaveParameters>element has been fixed to override previously saved parameter values. For example, previously it worked like this (and with a behavior version of 1 it will still work like this):<SaveParameters ID="MySave"> <A>A_VALUE</A> </SaveParameters> <SaveParameters ID="MySave" Append="Override"> <A>AN_OTHER_VALUE</A> </SaveParameters> <!-- MySave contains : --> <!-- <A>A_VALUE</A> --> <!-- <A>AN_OTHER_VALUE</A> -->However now it works more like this:
<!-- in BaseFolder --> <SaveParameters ID="MySave"> <A>A_VALUE</A> </SaveParameters> <SaveParameters ID="MySave" Append="Override"> <A>AN_OTHER_VALUE</A> </SaveParameters> <!-- MySave contains : --> <!-- <A>AN_OTHER_VALUE</A> -->
-
The
<Binding>element has been changed due to the new functionality for creating input actions to go along with the bindings. For example, previously it worked like this (and with a behavior version of 1 it will still work like this):<!-- Create a binding for key THROTTLE_FULL --> <Binding EventID="THROTTLE_FULL"> <Param>1</Param> </Binding> <!-- Create a binding with the ID Full_Throttle --> <Binding Alias="Full_Throttle"> <Param>1</Param> </Binding>However now it works more like this:
<!-- Create a binding for key THROTTLE_FULL --> <Binding EventID="THROTTLE_FULL"> <Action> <!-- action tags --> </Action> <Parameters> <Param>1</Param> </Parameters> </Binding> <!-- Create a binding with the ID Full_Throttle --> <Binding Alias="Full_Throttle"> <Action> <!-- action tags --> </Action> <Parameters> <Param>1</Param> </Parameters> </Binding>
- Input event presets and bindings have restrictions on their naming and can only use the following characters (in any combination):
AtoZatoZ0to9_and-[and]
- When using
<Loop>elements, the defined parameters are no longer valid during the whole duration of the loop - they are popped as soon as they have been loaded in memory. This is not previously the case.
- When setting up
<Condition>statements, the following elements have all been deprecated:<StringEqual>,<Value>,<Number>,<Text>. If these are used when the behavior version is greater than 1, then errors will be generated.
- The
<OverrideBaseEmissive>element is ignored and will always default to FALSE regardless of the setting, thus keeping the emissive factor from the 3D model export unaltered.
- All parameter elements (like
<Parameters>and<SaveParameters>) with an unspecifiedtypeattribute will now default to the "Override" type instead of "Default".