Dev Blog - Scenario Editor Deep Dive
Hey everyone,
I want to talk about the Scenario Editor today. This is a tool for creating gameplay in the game, starting from placing props around the game world, to setting up the functional logic that makes a mission work.

There is a lot we could talk about here, so I'm going to get right into it. Expect things to get very technical.
At the very core of the editor system are Props and Modules.

Props are objects you can place around the map. These can be anything from set decoration, track markers, to functional mission elements.

Some props are also procedural, like the geotex runways you can lay down anywhere, and they will adapt to the terrain.

Once placed, you can right click a prop to see its properties panel. Here you'll find various options to configure it, and also potentially various triggers. We'll look at those in a bit.
Scenario Modules are modular behaviors that can be used to set up the game or do the various things that missions might need. If you've used the Unity Engine before, this will probably feel very familiar.

Once you add a module to a mission stage, you can configure it using the sidebar panel. Each module has its own set of options here, and most of them will have inputs or outputs for triggers.
Triggers are the main way by which the different bits of the scenario logic can communicate with one another. Props and Modules can generate triggers, and you can connect trigger inputs from other things to these, so that when that trigger signal goes out, whatever is plugged in will receive it.

If this sounds a lot like a system of events and listeners to you, then you are very likely a programmer, and you are very much correct. That's exactly what they are.
To connect them, you just need to click the little port item on the input, and this will show all trigger outputs you can select. Just click on any of those to select it and you've now plugged a trigger onto a trigger input.
Another very big part of the scenario logic system are Parameters. These are a fairly recent addition, but since we introduced them they've completely changed the way we approach mission making.

Parameters are very much like global variables. They are defined in the mission parameters panel, and are always accessible to everything in the mission. They can be Bool, Int, Float or String types, and type conversion is fully supported.
Parameters can be read by or written to by props and modules using parameter input and output ports, which are connected in the same way you would link up triggers. To make it clear if something is going to be reading or writing, we've got different styles of input and output ports.

And lastly, Parameters can also come in the form of Expressions. Expressions are basically a line of script code, which gets evaluated and stores the result in the value of the parameter. This can be literally anything. It actually is a line of runtime compiled C# code, which allows you to access anything in the game, including the value of other parameters.

One of the main uses of parameters is for scoring. We made a special syntax that is supported in pretty much every text field missions use, where you can have the value of a parameter inserted into text. This gives mission authors full control over what is displayed during the mission, so you can create whatever mission structure you want.
Props and Modules typically have a combination of parameter and trigger inputs and outputs, and with those you can set up most of the mission logic for anything you might need.
Lastly, we have Scripts. You can use scripts through the Script Module, which lets you write actual code, which gets executed by an input trigger signal. Scripts are basically C# code, but they also support our custom syntax for accessing mission parameters.

You can also generate your own triggers from script, using another bit of custom syntax. We've got a precompiler process on scripts that picks out and generates scenario triggers for any occurrence of a triggering vocation in the script. You just call it up in the script, hit compile, and a new trigger appears on the list underneath.

Scripts are a also quite new to the Scenario Editor, but we are working on a complete scripting API, to make common operations easy to use via a set of commands. This will grow over time as we fill it out --we first need to figure out which operations are actually 'common' ones... We're calling it the ScnAPI, and it will also be supported for expressions.
There is a lot more I could talk about here, but this post is getting rather long already, and I couldn't possibly cover everything here.
We're hoping to do a series of tutorials on how to use the scenario editor, and we'll also have the documentation for it published along with the modding SDK. --and I should also mention, as a modder, you are fully able to create your own scenario modules to use in missions.
So that's about it for this post. I think this is one of the things I'm most excited about seeing other people use, once the game is out. I can't wait to see what people come up with using these tools.
As always, thanks for reading, and see you next time!
Felipe (aka HarvesteR).
----------
For all things KitHack Model Club, follow us on Twitter (X), and join us on Discord!
I want to talk about the Scenario Editor today. This is a tool for creating gameplay in the game, starting from placing props around the game world, to setting up the functional logic that makes a mission work.

There is a lot we could talk about here, so I'm going to get right into it. Expect things to get very technical.
At the very core of the editor system are Props and Modules.

Props are objects you can place around the map. These can be anything from set decoration, track markers, to functional mission elements.

Some props are also procedural, like the geotex runways you can lay down anywhere, and they will adapt to the terrain.

Once placed, you can right click a prop to see its properties panel. Here you'll find various options to configure it, and also potentially various triggers. We'll look at those in a bit.
Scenario Modules are modular behaviors that can be used to set up the game or do the various things that missions might need. If you've used the Unity Engine before, this will probably feel very familiar.

Once you add a module to a mission stage, you can configure it using the sidebar panel. Each module has its own set of options here, and most of them will have inputs or outputs for triggers.
Triggers are the main way by which the different bits of the scenario logic can communicate with one another. Props and Modules can generate triggers, and you can connect trigger inputs from other things to these, so that when that trigger signal goes out, whatever is plugged in will receive it.

If this sounds a lot like a system of events and listeners to you, then you are very likely a programmer, and you are very much correct. That's exactly what they are.
To connect them, you just need to click the little port item on the input, and this will show all trigger outputs you can select. Just click on any of those to select it and you've now plugged a trigger onto a trigger input.
Another very big part of the scenario logic system are Parameters. These are a fairly recent addition, but since we introduced them they've completely changed the way we approach mission making.

Parameters are very much like global variables. They are defined in the mission parameters panel, and are always accessible to everything in the mission. They can be Bool, Int, Float or String types, and type conversion is fully supported.
Parameters can be read by or written to by props and modules using parameter input and output ports, which are connected in the same way you would link up triggers. To make it clear if something is going to be reading or writing, we've got different styles of input and output ports.

And lastly, Parameters can also come in the form of Expressions. Expressions are basically a line of script code, which gets evaluated and stores the result in the value of the parameter. This can be literally anything. It actually is a line of runtime compiled C# code, which allows you to access anything in the game, including the value of other parameters.

One of the main uses of parameters is for scoring. We made a special syntax that is supported in pretty much every text field missions use, where you can have the value of a parameter inserted into text. This gives mission authors full control over what is displayed during the mission, so you can create whatever mission structure you want.
Props and Modules typically have a combination of parameter and trigger inputs and outputs, and with those you can set up most of the mission logic for anything you might need.
Lastly, we have Scripts. You can use scripts through the Script Module, which lets you write actual code, which gets executed by an input trigger signal. Scripts are basically C# code, but they also support our custom syntax for accessing mission parameters.

You can also generate your own triggers from script, using another bit of custom syntax. We've got a precompiler process on scripts that picks out and generates scenario triggers for any occurrence of a triggering vocation in the script. You just call it up in the script, hit compile, and a new trigger appears on the list underneath.

Scripts are a also quite new to the Scenario Editor, but we are working on a complete scripting API, to make common operations easy to use via a set of commands. This will grow over time as we fill it out --we first need to figure out which operations are actually 'common' ones... We're calling it the ScnAPI, and it will also be supported for expressions.
There is a lot more I could talk about here, but this post is getting rather long already, and I couldn't possibly cover everything here.
We're hoping to do a series of tutorials on how to use the scenario editor, and we'll also have the documentation for it published along with the modding SDK. --and I should also mention, as a modder, you are fully able to create your own scenario modules to use in missions.
So that's about it for this post. I think this is one of the things I'm most excited about seeing other people use, once the game is out. I can't wait to see what people come up with using these tools.
As always, thanks for reading, and see you next time!
Felipe (aka HarvesteR).
----------
For all things KitHack Model Club, follow us on Twitter (X), and join us on Discord!