VARS AND EVENTS AIRCRAFT

The VarsAndEvents aircraft is a preset of the WASM modular aircraft, which shows a simple example of the WebAssembly Vars and Events APIs. Once the WASM Aircraft package has been built, this module will be available for flying from the aircraft selection screen:

Selecting The Vars And Events Aircraft In The Simulation

 

The WasmModules.sln file (found in the Sources folder of the project) will allow you to compile the source-code with Microsoft Visual Studio (2019 or 2022) in order to create the VarsAndEventsAircraft.wasm WebAssembly module which will then be loaded by the game. Once compiled, the module will automatically be copied into the following folder:

[ROOT]\PackageSources\SimObjects\Airplanes\MyCompany_Wasm_Aircraft\presets\mycompany\VarsAndEventsAircraft\panel

 

Note that if you make changes to the C++ code and recompile the vars and events WASM module, you will have to build your package again. This can be done while the plane is used within the simulation.

 

 

Testing

Once you have built the aircraft and selected it, you can go into a Free Flight and you will see three panels in the cockpit:

The Cockpit Interior Of The Vars And Events Aircraft

 

In this sample the first two screens are similar to those in the GaugeAircraft however they retrieve the pitch, bank, and heading values using callbacks to the Vars API. The right-most screen will show a continuous stream of information related to events that the gauge has sent to itself containing different types of data. In this example the events sent are (in order): 1, 11ULL, 12ULL, 2, "a", 3, "b", "c", 13ULL. The screen will also change colour depending on the K: events received, where the THROTTLE_DECR event is green and THROTTLE_INCR event is red.