Get the latest tech news

Flying planes in Microsoft Flight Simulator with a JavaScript autopilot (2023)


Writing auto-pilots in JavaScript for MSFS

So yeah, this should be relatively obvious: our autopilot is more aggressive than the in-game one, which means it won’t be as smooth of a ride, but the more important thing to notice is that our VS is not centered around zero, and our bank angle isn’t either, even if it’s hard to tell. Let’s look at the difference this makes, by temporarily changing the charting config for our heading value from “always show the full 0 through 360 degrees” to “dynamically zoom the graph as needed” (similar to how vertical speed gets plotted). Adding polygon-awareness Let’s make life easy (well, “easier”) on ourselves and restrict the kind of shapes we work with to polygons, with GPS coordinates as vertices, so we can ask our server for something like http://localhost:9000/?poly=47.8,-123.1,47.8,-123.99,48.99,-123.99,48.99,-123.1 and have it know we mean the “rectangle” (not really, but at small scale, close enough) spanned by N47.8W123.1 and N48.99W123.99.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of javascript

javascript

Photo of JavaScript autopilot

JavaScript autopilot

Photo of Flying planes

Flying planes

Related news:

News photo

Cylon: JavaScript framework for robotics, drones, and the Internet of Things

News photo

At some point, JavaScript got good

News photo

The last days of my type checker for JavaScript