Let's have JavaScript fly a plane in Microsoft Flight Simulator 2020



Let's have JavaScript fly a plane in Microsoft Flight Simulator 2020

Let's have JavaScript fly a plane in Microsoft Flight Simulator 2020

Before anything else: this is a recording where I clicked five times in a browser. and that’s all I did. I am not flying this aeroplane. With that said:

So I discovered MSFS2020’s SimConnect, and found out there’s a JS connector that brings SimConnect to JavaScript. And that opens up a world of tinkering and nonsensery that can, if done right (or wrong, depending on a need for realism) lead to basically fully automated flight, where the computer flies the computer. This is probably the most expensive screensaver in history =D

(And please, fact check that. I want to know what the most expensive screensaver in history is O_o)

And yes, I know about the duplicate “gentle bank” top-title. It is what it is, I’m not re-uploading a 2.5GB video just to fix that. Also, something I care more about: the stall speed on the DHC-2 is 53kts so we’re aiming for 73, not 83, which is why –and this should have been obvious during editing– we end up going slower than 83. Fact checking yourself is hard, man =(

Links for things mentioned:
– MSFS2020: https://store.steampowered.com/app/1250410/Microsoft_Flight_Simulator_40th_Anniversary_Edition/
– SimConnect: https://docs.flightsimulator.com/html/Introduction/Introduction.htm
– The “pure” Node.js library for the simconnect.dll file: https://github.com/EvenAR/node-simconnect (EvenAR is an absolute legend, and a hero)
– My more “JS-ish” wrapper for node-simconnect: https://github.com/Pomax/msfs-simconnect-api-wrapper
– The repo that houses this autopilot: coming soon

(And that’s not a “soon” in quotes, it already exists, the main branch just needs to get deleted because it’s an older python+node hodgepodge that does not deserve to stick around. I’m documenting the auto-landing code over the next few days, after which the repo will get updated to not just the “real” code, but also a full tutorial! Because don’t you just hate projects that go “here’s the code, have fun” without anything that teaches you why it works, and how to dive in and mess about, yourself? I sure do, so this is going to be a 30k+ word doozy of a start-to-finish tutorial!)