Getting started with WASM

I’m trying to get started with the WASM Modules but I have no Idea how and where. I know there is a GaugeAircraft in the SDK. Now I don’t know how to start with it like how to debug it so I can see what happens. Is there a good tutorial out here? I searched myself but couldn’t find anything. Maybe I’m just blind.

1 Like

I suggest starting Visual Studio and create a new WASM project. This gives you already the foundation. Then the question is what you want to do.

From there it’s easy to use Gauge API or open a SimConnect connection and do what you like to do…

Okay thanks. I created th eproject in Visual Studio. Now the SDK says I need to copy the WebAssembly moduile to the panel folder of my simobject. In the sample thios is a wasm file. But in my Project there is no wasm file even if I build it. So I’m stuck at the “Build the package” step in the sdk.

That is strange, I just tested, when you create a new project based on template WASM module, it builds and creates a WASM successfully for me. The WASM can then be found in:
<project folder>\MSFS\<configuration>\

Have you checked the build log?

It says there is one but I can only find this in the Debug folder:

As you can see from the name it’s the second project I created without making any adjustments to it. I see the wasm.recipe but that’s not the same right? Or am I missing a post build event?
Build Log in the console:
Build started…
1>------ Build started: Project: WASM_Module2, Configuration: Debug MSFS ------
1>WASM_Module2.vcxproj -> C:\Users\Manuel\source\repos\WASM_Module2\MSFS\Debug\WASM_Module2.wasm
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

At last – someone who know about WASM ?

Can you tell me if it should be possible to use WASM, to interface with a JS gauge, and allow that gauge to write back to the storage system, (outside of the Sandbox), even if it is only to a specific file, already there, Gauge’s Js folder structure, in the Community folder.

Specifically, to write back a Flight Plan, that has been edited or created in a custom GPS Gauge, and will survive a re-start of MSFS,

Nevermind found the WASM Module. I looked in the wrong folder I’m an idiot. I hope I can debug it now

Writing outside the sandbox is not possible as far as I know. You can only use the API of the WASM, but not the public one, the one MS provides.

Other than that you can of course use named variables (L-Vars) to interface with gauges in JS or others. You can even use SimConnect client data section for this from the WASM.

I’m regulary interfacing between MATLAB Simulink and the WASM for example. You can have a look into the a32nx fbw branch if you want to see what is done there with WASM.

I thought the FBW is not with WASM or is it? Can you provide a link to the exact branch you mean?
I saw that they want to rewrite it with WASM that’s why I thought I could start research ist and try it out a bit so I can maybe help them develop it.

The custom FBW is implemented in a wasm, of course. I think everything else would be a disaster from the performance point of view:
flybywiresim/a32nx at fbw (

I should know it :wink:

I just realized you are one of them who works one it lol. I managed to find it . Sometimes I‘m just blind when I‘m overwhelmed sorry. I managed to build a samplewasm and will test it tomorrow. I hope I can get better at this so one day I can develop an aircraft or be part of a team :smiley: Thank you so much for your help so far.

1 Like

So I found the wasm object from you guys and it really helps me to get started. I always need something to see to learn it and this helps me a lot. But there is one thing that I am not sure if it’s on my end. VS2019 always underlines the “attribute((export_name(“FlyByWire_gauge_callback”)))” as red like this:

Is this a VS problem or is my ReSharper telling me off?
(Yes dark theme because it’s early in the morning :stuck_out_tongue: )
I can read the code sort of I am a Software developer but I mainly used C# and JavaScript so C++ and WebAssembly is all new but I want to learn it.

if you are compiling using the visual studio sdk you can remove that line entirely (although it isn’t incorrect, your IDE is just not trained to recognize clang attributes). A32NX’s build process invokes clang directly so we have to manually recreate some of the things the sdk does automatically.

Ah okay thanks. I’m currently trying to debug the FBW wasm and try to understand the code and how the wasm works. It really helps when I can do it with something I’m more familiar with.

I’m fluent now with the SDK simconnect … now can you explain to me what WASM is, and what does it offer?

@ZenMusic2 there’s more info about it in the sdk docs: WebAssembly

1 Like

Is it possible to set Simvar values from WASM? The docs say the token sim-vars can’t be set, but I’m not sure if that includes ALL simvars. I know locals can be set from WASM

Most are read only, but a few are also setable.

very often, there seems little reason why this is so.

KOLSMAN SETTING MB is read & setable

Most plausible reason : “This is how it’s always been in previous Versions of FS” ?

1 Like

Thanks for the reply. The variables that are settable, can it be done without using SimConnect? For example in the WASM template you can simply use aircraft_varget() to read a simvar, is there a simple way to do this to set those simvars?

Or is it necessary to use Simconnect?

A: variables cannot be set through the panels SDK (there’s no aircraft_varset() as a counterpart to the aircraft_varget() ), but they have key events instead that will act on their values.

1 Like