(Live) METAR weather data for Aerofly FS 2

  • For me weather is one of the main challenging aspects of every flight simulator. Aerofly FS 2 offers some controls to change the in-game weather - but I always forgot about them, or did not take the time to set them to real world conditions, let alone set the time correctly. But wouldn't it be cool to set the weather conditions (and time) to real-life conditions by just the press of a button? To brave the the same wind conditions, wind gusts, or dark and foggy nights like real-world pilots have to do right now?


    Actually there are plenty of sources for real-world aviation weather in a machine readable format called METAR. On the other hand Aerofly FS 2 stores its weather settings in its main configuration file. So...


    I build a small tool called Aerofly-Weather (short: AeroWX) which copies the METAR weather and time information to your configuration file while Aerofly FS 2 is not running. AeroWX imports METAR weather information from an internet service (like AVWX and CheckWX) or accepts direct input of METAR strings (e.g. to supply METAR data for your favourite hurricane).

    Keep in mind that while your simulation is running, your weather will not be updated. You may set your weather before starting AFS2, but the tool cannot change it while AFS2 is running (as for now).


    AeroWX has been tested on Windows 10 and the STEAM-version of AFS2. AeroWX is a little rough around the edges, comes with no warranty or support of any kind, is a strain on the eyes, requires you to actually read its manual, and its installation requires Node.js and at least three terminal commands. You have been warned. ;)


    So here it is: https://www.npmjs.com/package/aerofly-weather


    (P.S.: Cross-posted from Steam's Aerofly FS 2 forum)

  • I think using the SDK and the example dll you should also be able to inject wind speed and visibility from the outside. There are even short-cuts for the visibility incr/decr. so you might be able to send these from the outside in real time, too.

  • Indeed I just took a quick look at the sample DLL files. I already found some stuff which spark my interest. Without any actual knowledge of the API I found:

    • "Aircraft.NearestAirport" could be used to get the nearest ICAO code and fetch the weather.
    • "Aircraft.Wind" could be used to set the wind (direction? strength?).
    • "Simulation.Visibility" could be used to set the visibility.
    • "Simulation.Time" could be used to set / read the time.

    Sadly I did not find methods to set turbulence, thermal activity, cloud layer 1-3 and date. Does someone know if there are methods to set these?

  • Indeed I just took a quick look at the sample DLL files. I already found some stuff which spark my interest. Without any actual knowledge of the API I found:

    • "Aircraft.NearestAirport" could be used to get the nearest ICAO code and fetch the weather.
    • "Aircraft.Wind" could be used to set the wind (direction? strength?).
    • "Simulation.Visibility" could be used to set the visibility.
    • "Simulation.Time" could be used to set / read the time.

    Sadly I did not find methods to set turbulence, thermal activity, cloud layer 1-3 and date. Does someone know if there are methods to set these?

    I don't think these messages are documented but we use very good naming conventions, so Simulation.Turbulence or Aircraft.Turbulence could already be what you need.

  • Hej Jet-Pack, could you point me in the right direction on what components to install to MS Visual Studio to compile the DLL example? As of now I get tons of errors like "cannot open source file 'errno.h'" and "the global scope has no 'floorf'". As a newcomer to the world of C++ I don't get it, and Stackoverflow is no help either.

  • OK, I have a clean install Visual Studio Community 2017 on Windows 10 - 1809. Ticked the boxes for :

    • Visual Studio Core Editor
    • Desktop development for C++
    • Game development with C++
    • Individual components > Windows 8.1 SDK (as the project told me it was required)

    I checked the

    • VC++ Include Directories, it says "$(VC_IncludePath);$(WindowsSDK_IncludePath);".
    • VC++ Library Directories, it says "$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86"

    In tm_external_message.h the following errors occur:

    • Error (active) E1696 cannot open source file "assert.h" ...\shared\input\tm_external_message.h 37
    • Error (active) E1696 cannot open source file "math.h" ...\shared\input\tm_external_message.h 38

    ...among 421 Build + IntelliSense errors. :?

  • Okay, I build myself a small roadmap:

    1. NodeJS command line tool (done, see https://www.npmjs.com/package/aerofly-weather)
    2. NodeJS desktop application (done, see https://www.npmjs.com/package/aerofly-weather)
    3. C++ command line tool (done, but not published yet, because it does essentially the same as the NodeJS CLI tool - but is it a good foundation for the next steps…)
    4. C++ desktop application (I am working on that - this will be way smaller than the NodeJS desktop application)
    5. C++ DLL (integrates right into Aerofly FS 2)

    I am still learning C++ (currently unit testing and DLL building), so the progress is somewhat slower than with NodeJS, but I am confident I'll eventually finish the project. ;)


    My current idea for the DLL:

    • On entering the cockpit you have to enable the METAR updater. (My current idea is to switch your radio to a certain channel to activate the METAR updater - to deactivate the METAR updater you'll just have to change the channel. ^^)
    • The DLL detects the nearest airport, and loads time and weather into the simulation.
    • As long as the METAR updater is active, every X minutes or on detecting a new nearest airport new weather will be downloaded and the current weather will be gradually changed.

    The big benefit is that for long flights and on spontaneous changes of your location the METAR updater will still do its job, while the current tools/applications only allow for setting the weather while the simulation is not running.


    As for the demo DLL project: I have a fellow programmer look into that. Being new to C++ / Visual Studio / desktop programming makes it somewhat hard to grasp the exact reason for above error messages.

    1. C++ desktop application (I am working on that - this will be way smaller than the NodeJS desktop application)
    2. C++ DLL (integrates right into Aerofly FS 2)

    I like the idea of a dynamically updating weather app.


    Why not save yourself the hassle of C++ and do a C# GUI app?


    I've been meaning to write a C# wrapper example for an Aerofly Plugin, it'd probably be useful for several applications.

  • Well, actually the idea of doing it in C++ was mainly because the example DLL was written in C++. If you happen to do a DLL wrapper in C#, I'll gladly take a look at it.

    What I mean is that you can do a very simple plugin DLL in C++ that takes weather information and sets it in the sim, do the GUI and everything else in C# and make them talk with some kind of IPC (named pipes, UDP, TCP, shared memory).


    You could even keep your existing Node GUI with that method.


    The wrapper would be for writing the logic of AF plugin itself in C#. You don't necessarily need it to do some of this in C# or Node.


    Windows GUI programming in C++ isn't much fun, so just throwing that out there.