top | item 44695364

Microsoft Flight Simulator 2024: WebAssembly SDK

152 points| breve | 8 months ago |docs.flightsimulator.com | reply

115 comments

order
[+] shizcakes|7 months ago|reply
I have about 1000 hours into MSFS2024 and am a mod for a streamer that has streamed many hours more.

The gamer perception of this implementation is NOT positive. It crashes all the time, has massive performance issues, and generally is super negatively received.

[+] lsaferite|7 months ago|reply
> gamer perception

Is there evidence to support that it's the WASM Mod format that's the issue? Based on that page it's not like MSFS2024 is even running WASM, it's simply using WASM as an IL that is precompiled into a DLL on application startup.

[+] thecosmicfrog|7 months ago|reply
"WASM crash?" must be one of the top live chat comments on flight sim streams these days.
[+] izacus|7 months ago|reply
I keep holding off on buying 2024 due to all the reported bugs and I'm still sad to hear it hasn't been fixed.
[+] NikolaNovak|7 months ago|reply
Thx - any details as to why, tough?
[+] nixpulvis|7 months ago|reply
It likely requires major updates, no? In that case many addons are probably poorly updated and having bugs due to being rushed and haphazardly ported.
[+] pjmlp|7 months ago|reply
Already a quick look to "Known Issues and Limitations" is quite off putting to anyone thinking about doing mods.
[+] Stevvo|7 months ago|reply
It crashes when a developer writes code that crashes, which is not uncommon; its C++.
[+] sitzkrieg|7 months ago|reply
its also considered total dogshit in any serious sim and training circle too!
[+] affenape|7 months ago|reply
For something having 2024 in its name I expected a more consistent error handling, but guess what:

* some functions like fsRenderCreate return 0 or 1 depending on the operation result;

* some like fsMapViewCreate say that a value less than 0 is returned on error;

* fsIOOpen says you should also consult with the fsIOGetLastError function on failure.

Hope somebody considers adding the errno.

[+] two_handfuls|7 months ago|reply
This is great news for WASM, and looks like the Microsoft team really put in a lot of effort!

> In order to [move the addons API to WASM] without requiring a full rewrite of existing add-ons, a new platform toolset was designed for Visual Studio (...)

[+] boffinAudio|7 months ago|reply
I dunno, I think I would've preferred Lua bytecode as a deliverable executable target, rather than WebAssembly. The tooling would be simpler, more efficient, and would allow a far wider ranger of interoperability with other engines.
[+] thecosmicfrog|7 months ago|reply
One of the biggest factors for any flight simulation add-on is performance, and so most of the major add-on developers are building C++ modules (compiled to WASM) to eek out as much performance as possible. My understanding is that it's also possible to write some things in JavaScript (and perhaps TypeScript), but performance takes a hit. I would assume Lua falls into that same performance trap, as I know Lua can be used for X-Plane add-on development, but it's (again) considered the less performance-centric approach as compared to C++.

I recall at least one add-on developer for X-Plane (Zibo [1]) migrating some of their Lua code over to C++.

[1] https://forums.x-plane.org/forums/topic/138974-b737-800x-zib...

[+] Dylan16807|7 months ago|reply
Lua source is better. Compiling is super fast and bytecode is very hard to prevent exploits in.
[+] whatever1|7 months ago|reply
I am not sure I am following. The game runs on windows, why not compile the add-in code directly for the single target?

Is it for future proofing it in case MS wants to release the game in a different platform that is not windows ?

[+] JonathonW|7 months ago|reply
Because the game already also runs on Xbox and, given MS's recent gaming strategy (which is putting less emphasis on Xbox exclusives), could conceivably come to Playstation or maybe even Switch 2 in the future.

On the Windows side of things, there's also a push towards ARM hardware (with current Snapdragon-based hardware actually performing pretty well). Not sure if Flight Simulator is currently ARM-native, but having the ability to go ARM-native is probably desirable at least as a long-term goal.

[+] potatolicious|7 months ago|reply
Security is the big one. C++ DLLs have relatively free reign and are difficult to sandbox. With WASM you have a much stricter security model where the host program has full control over what APIs it has access to.

The addons are developed by third parties that aren't Microsoft, so there's a serious risk of malware and other ways of getting the user pwned.

The added future-proofing/portability is a nice bonus, but I suspect maybe not the main motivator.

[+] connicpu|7 months ago|reply
WASM brings a memory sandbox that prevents out of bounds access to arbitrary pointers.
[+] p_l|7 months ago|reply
There were already parts in MSFS 2020, namely gauges aka everything in cockpit that had more dynamic display, that used JS based SDK in order to provide sandboxing and safe level of control over performance (because with sandboxes VM it's easier to preempt execution)
[+] ethan_smith|7 months ago|reply
WASM provides a secure sandbox with predictable performance across platforms while giving Microsoft the ability to maintain compatibility if they port to Xbox, cloud, or other platforms without requiring developers to recompile their add-ons.
[+] hamburglar|7 months ago|reply
Isn’t there ARM windows too? Not sure if flight sim targets that platform or not, but if so, making the extensions more portable is a win.
[+] tapoxi|7 months ago|reply
> Is it for future proofing it in case MS wants to release the game in a different platform that is not windows ?

Strongly rumored to be releasing on PS5, like most recent Microsoft games.

[+] 01HNNWZ0MV43FF|7 months ago|reply
In addition to the sibling comments, you can sandbox WASM's CPU time. You can say after a certain amount of time that it has to yield back to the host. With native plugins, you might never get your OS thread back, and there isn't a good way to safely abort it and free memory and everything
[+] selectodude|7 months ago|reply
It runs on Xbox as well so I imagine they want the flexibility there.
[+] diego_moita|7 months ago|reply
This is one of those ideas that makes so much sense that you'd ask why didn't it catch on before: WASM as a modules for all sorts of platforms

It could become a competitor for a lot of existing technologies. Some examples:

* embedded script languages (e.g.: Python in Blender and Gimp, Lua in games, VBScript in MS applications).

* add-on modules (e.g. COM on Microsoft platforms or COM-like for non-MS)

* finally, a run-anywhere platform? (what the JVM and .Net always wanted to be)

[+] rafram|7 months ago|reply
> finally, a run-anywhere platform? (what the JVM and .Net always wanted to be)

WebAssembly doesn’t include a system interface, i.e., any way to interact with the outside world, so it isn’t an apples-to-apples comparison.

WASI seems like it’s coming along nicely, but it has nowhere near the feature set of the JRE or .NET. Anything that even approaches that level of capability is going to run into the exact same bloat and platform compatibility problems that those runtimes did.

[+] pjmlp|7 months ago|reply
Because this idea has been done multiple times throughout the years with different kinds of bytecodes and VMs, since UNCOL in 1958, the WebAssembly folks just pretend they are always the first at something.
[+] esafak|7 months ago|reply
Java applets say hello! Maybe they were just before their time, hobbled by slow computers, hard disks, and Internet connections.
[+] jahewson|7 months ago|reply
Indeed, CloudFlare Workers does this. Would love to see more.
[+] astlouis44|7 months ago|reply
Yep, pretty sure that is what companies like Dylibso are working towards, making software into modules underpinned by plugins that are powered by WASM:

https://dylibso.com/

[+] tough|7 months ago|reply
wasm is the perfect abstraction to build a -modular- and pluggable codebase (say grpc/proto as contracts) so you can just swap any part of it as long as the wasm module abides to such contract.

I keep going more and more to it when I try to design systems, in my mind at least, hoping I can put some to use

[+] euroderf|7 months ago|reply
Wasm "web components" should be helpful here.
[+] CSMastermind|7 months ago|reply
I was recently thinking about the most influential games of all time.

I think there's a good argument for Flight Simulator to be in the top 100.

[+] reactordev|7 months ago|reply
the career mode kid play is what killed the franchise for me
[+] leetrout|7 months ago|reply
If they had actually taught / allowed actual procedures it would have been better for me.

I think they did a great job focusing on the important parts of flying for the missions and such but things like ATC telling you to land on one run way and the visual assists leading to the wrong runway are terrible. My big pet peeve is unrealistic ground ops and rules where it is legal and expected to exit a runway and enter a taxi way you will randomly get dinged for entering a taxiway without permission (at smaller towered and towered fields).

[+] avazhi|7 months ago|reply
Graphics are good but as a flight simulator it’s awful, in particular its (non) simulation of fluid dynamics. X-Plane has the opposite problem.

At any rate with their budget Asobo are underperforming with this thing. 2024 in particular is enshittification 101.

[+] jon-wood|7 months ago|reply
Is it "awful" though, or is it just not quite as accurate as X-Plane? Because I've seen a far few videos from actual pilots of various aircraft playing Flight Sim 2024, and generally what they say is that while it's not the same as flying the real thing (mostly because of the lack of feedback for things like trim adjustment) it's pretty damn close. Just because that was achieved by writing specific models for each aircraft rather than full fluid dynamics simulation I don't think that makes it awful.
[+] ingen0s|7 months ago|reply
Well now, thats progress.
[+] naikrovek|7 months ago|reply
I feel like everyone is trying to do things in the most inefficient way possible and it is starting to make me a little bit batty.

WASM is awesome, but if I'm reading this right, they're choosing not to write DLLs so that they can create WASM modules which are recompiled into DLLs prior to runtime.

I think our entire industry has taken banned-by-the-Geneva-Conventions, weapons-grade Stupid Pills.

The only reason I can think of to do this, is so that you can't have arbitrarily malevolent code running in the DLLs that mod authors write. But we can't run the whole game in a sandbox such as a VM because of Nvidia GPU licensing disallowing virtual GPUs in consumer grade GPUs.

If that's why this work is being done, some serious muscle needs to be used to twist Nvidias arm so that they stop being knobheads and start being part of the solution to security issues, instead of part of the problem.

If I pay for that GPU, I should be able to issue work to it however I please. I should be able to split it up among VMs all day long without concern for anything Nvidia wants.

[+] Cieric|7 months ago|reply
When the modding community is so heavily plagued with mods that are malicious in some way, I don't think having a modding api that can be safe by convention yet recompiled to be fast would be a bad idea. So while I'm not sure it was the smartest choice, it's not so inanely stupid as you seem to be putting it.
[+] spullara|7 months ago|reply
"The only reason I can think of to do this, is so that you can't have arbitrarily malevolent code running in the DLLs that mod authors write."

This is the only reason and you go on to show that it is a reasonable thing to do given the state of the world.

[+] Pannoniae|7 months ago|reply
you're being downvoted sadly, but you are 100% right ;)

long gone are the days of games with actual modding support (think of games like CS:1.6, half-life, civ4 where you had a dll src with the game)

the whole "mods can have malware" with them is just an overblown risk assessment, most people do the right thing. there's been like fewer than 10 malware incidents with minecraft modding over the years and most of it has been recently because trust in that modding community has basically evaporated.

it's a much better stance to just let mods do whatever and hold their authors accountable with their reputation. srsly.