Prepar3D v3 has introduced numerous new features, including the addition of Adobe® Scaleform®. We’ve utilized this technology inside of our application to provide a more visually appealing and responsive experience with our menus, on-screen information, and modeless user interface windows such as the Air Traffic Controller (ATC) window. This technology isn’t just for internal use and in this blog post, it will be described how scenario developers can use it too!
Our scenario creation tool, SimDirector, has been updated with new objects that aid in creating a rich content experience. To help integrate Scaleform content creation into the existing scenario framework, SimDirector’s scripting capabilities have been updated! Now, you can use new scripting and scenario variables concepts to customize your scenarios.
As previously mentioned, Adobe Scaleform has been included to the Prepar3D tool set. For content developers this means that creating panels and gauges can now be accomplished using Scaleform and re-theming existing Scaleform user interfaces is now possible.
For scenario developers, there are two types of Scaleform content that can be created in SimDirector: Scaleform Panels and Scaleform Objects.
Panels are an important part of Prepar3D’s simulation experience and are used to implement not only vehicle panels (e.g. GPS, PFD, and MFD) but scenario panels (e.g. Countdown Timer and Points of Interest) as well. With the release of v3, this has been expanded to include Scaleform Panels whose purpose is to allow scenario developers to insert rich content into their scenario at any point. Scaleform Panels can be opened, closed, and manipulated in the same fashion as other panels by the user or programmatically using SimDirector objects. Some common uses of this feature include the following:
- Displaying pertinent diagrams, documents, and videos
- Providing informational displays containing useful simulation variables
- Creating your own scenario panel (e.g. custom timer and scenario objectives)
- Gathering user input (e.g. custom UI form with a submission button)
There are many different types of scenario objects that can exist at a physical location in the world. For example, scenery, entities, and cameras are implemented as world objects and have been available to place since SimDirector’s inception. Many of these objects support attaching to either a fixed location or another object which could potentially be moving. Scaleform Objects allow Scaleform content to be placed in the world with the same level of customization as these other world objects. Additionally, there a multitude of properties that the Scaleform Object supports such as sizing constraints, camera facing, material settings, and more! The possibilities of this object are endless as it allows the scenario developer to bring to life concepts such as:
- Creating life-like digital displays (e.g. arrivals and departures display)
- Providing annotations to the user (e.g. arrows, hints, highlighting)
- Any of the previous Scaleform Panel use cases in 3D space
Scenario Variables and Scripting
Scenario Variables are a new addition to SimDirector in Prepar3D v3. They allow scenario creators to store and recall custom named variables of various different data types during the lifetime of a scenario. Scenario variables are incredibly flexible and can be utilized in SimDirector’s visual scripting, LUA scripting, RPN scripting, and Scaleform content.
In order to accommodate the integration of Scaleform into Prepar3D, scenario variables can also be instanced. Some objects are aware of their instance name (such as the new Scaleform Panel or Scaleform Object), so that generalized scripts can be written to manipulate multiple instances of the same object type.
The easiest way to interact with scenario variables is through scripts contained within the new Script Action and Script Trigger in SimDirector. Inside of the Script Action and Script Trigger objects, LUA or RPN scripts can be written to store and recall any of the variables exposed through Prepar3D, including any scenario variables that have been created. The addition of scripting to SimDirector adds a world of new possibilities to scenario development, making complex interactions finally within reach!
A Comprehensive Example
A sample scenario has been included in the Scenario SDK, located in your \Prepar3D\SDK\Scenario SDK\ folder in Prepar3D v3, which shows how to play the classic game of Tic-Tac-Toe using all of the features outlined above.
In the sample scenario, a full featured game of Tic-Tac-Toe with scoring can be played either in 2D-space or in 3D-space. The scenario is divided into the following three parts: game data, game visuals, and game logic.
All of the game data is stored in the scenario variable system. The new Scenario Variable object is used for each variable to automatically create the variable with an initial value and instance name. The game data that is stored and updated includes information such as each player’s score, each game square state, and the current player’s turn.
The game visuals use Adobe Flash®. Each game square is implemented as a separate Scaleform Panel or Scaleform Object depending on the playing style chosen. The game square uses the Prepar3D Interface to query for the scenario variable that represents whether that game square has been played on. If it has been played on, the appropriate nought or cross is drawn. By clicking the game square, the state is updated and redrawn.
The game logic is implemented using LUA script. A Script Action is executed whenever the Scenario Variable relating to the current player changes. This LUA script checks win and tie states and awards points and potentially clears the board.
Using all of these features in orchestration allows for generalized content such as Tic-Tac-Toe to be implemented, but don’t be fooled! These capabilities (Scaleform, scripting, and variable access mechanisms) provide the essential mechanisms to create high quality educational content in the flight, maritime, and ground training domain.
We hope you enjoy using SimDirector in Prepar3D v3, and we’re looking forward to seeing the scenarios that you create!
For any technical development support, please post in our forums.