Aerofly FS4 Bridge DLL

  • Hi! I am very happy to announce that I finished my DLL project. It has plenty of documentation and I will keep adding examples.

    I hope it is useful for the Aerofly FS4 community, for the moment it is only available for the Microsoft Windows 10/11 version of the simulator.

    Here I open the discussion for comments, support and suggestions.

    Now it is time to start building integrations or new applications with this, and for new developers to improve the DLL and build their own version for their project's needs, I hope this work can be useful to them. Happy flying!

    Aerofly FS4 Bridge DLL Repository

    Best regards, Juan

  • Just wanted to add, that this release doesn't cover the controls.tmd variables from individual aircrafts.

    As an example, I extracted some of these additional variables from the Cessna 172 controls.tmd file and added them to the DLL source code,as a reference for adding some others we may need.

    So, at this stage, I think custom DLLs must be done for custom aplications, we still don't have a DLL that works for all the needs.

    There are more than 5.500 variables defined in the controls.tmd files for all the aircrafts.

    Best regards, Juan

  • Hi Juan,

    I wanted to sincerely thank you for your incredible work on the Aerofly FS4 Bridge DLL. I’ve downloaded the file and I’m really impressed by the quality and clarity of your documentation — it’s rare to see something so well-structured and well-explained.

    I also took note of your important precision: this release doesn’t cover the controls.tmd variables from individual aircraft. As you mentioned, there are over 5,500 variables defined in these files across all aircrafts, and you’ve extracted some from the Cessna 172 controls.tmd file as a reference for adding others we might need.

    It’s clear that at this stage, custom DLLs are necessary for specific applications, and we still don’t have a “one-size-fits-all” DLL for all possible needs. I think it’s great that you’re open to including cool custom examples in the examples section — this could encourage the community to contribute and expand the library.

    I’ll be running some tests on my side soon, and I’ll be happy to share my results or any useful examples I can come up with.

    Thanks again for your help and expertise.

    Best regards,
    Pascal

  • Hi Juan,

    Many thanks. Just took a first look on your new repository and first dll release.

    Noticed, that "memory positions" using shared memory changed for some values and also a AeroflyBridge_offsets.json file is needed for your Python Console to trigger it out.
    python_app_tutorial.md:
    A JSON offsets file (`AeroflyBridge_offsets.json`) accompanies the DLL describing the byte offsets for each variable.

    But I can't find this file in your new repository.
    So where can I get it to get your phyton console running and figure out the offsets for each variable?

    By the way, I'm glad that, according to your screenshot, there are now also string variabes such as the name and the transponder code.

    Best regards,
    Christophe

    Enthusiast and experienced creator of enhanced Aerofly FS Sceneries and Mods. Enjoy! 8)

  • Hi Chris! good questions, forgot to comment. In the externall_dll folder the json file is generated each time you start the sim.

    And if you export your variables from the same app, it will be saved there too:

    I modified the GUI adding a comment at the footer and in the source code a comment. Thanks!

    Best regards, Juan

    Edited 2 times, last by Jugac64 (August 11, 2025 at 9:23 PM).

  • Thanks Juan, for your feedback.

    I found my personal JSON file in externall_dll and can now read the offset of all the values by running your aerofly_realtime_monitor.py.

    But does this mean that all users now may have different resp. individual offsets for the corresponding values, or can I trust that, for example, the latitude and longitude coordinates will always have the offset 2328 and 2336 (instead of 16 and 24 as before) for all users?

    Best regards,
    Chris

    Enthusiast and experienced creator of enhanced Aerofly FS Sceneries and Mods. Enjoy! 8)

  • Hi Chris! here it is the answer from the new ChatGPT 5 model, that everybody is talking about. By the way, the timing was perfect, with it launch I could use it to finish the project. We will have time to talk about all these soon, thanks for your interest and tests.

    Short answer: offsets are not per-user; they’re per-DLL build/version.

    - Don’t hardcode absolute byte offsets like 2328/2336. They can change between releases as the struct/layout evolves.
    - Instead, use the offsets JSON that’s generated next to the DLL. That file is the source of truth for that DLL version.
    - Even better for shared memory: use the logical index approach from the JSON (array_base_offset + index × stride_bytes). The variable indexes (e.g., for latitude/longitude) are stable by name; we keep name→index consistent and append new vars at the end when needed.
    - If you want maximum forward-compatibility, use the TCP or WebSocket APIs and read by canonical variable name.

    So: all users with the same DLL build share the same offsets, but offsets can change across versions. Use the JSON (and/or index-based addressing) rather than fixed numbers.

    Best regards, Juan

    Edited 2 times, last by Jugac64 (August 11, 2025 at 10:39 PM).

  • Hi, I was thinking, since the repository is becoming more an more an educational resource, and I keep adding tutorials, a nice way to teach young kids computing would be to do integrations with the sim, because it is very cool to see something you do and interact with the aircrafts.

    I think kids would enjoy this :) so maybe Ipacs could offer the sim to schools to use it as a simulation and development laboratory.

    The tutorials are AI generated, then I test them and fix errors. But first I generate them, upload them to the repository and later I test them.

    So some of them will have errors, and will be fixed with time.

    Best regards, Juan

  • Hi Juan,

    Just found your autopilot script and very easy way to install the DLL bridge. Feel kinda silly I trying using the docs and could never get that to work when attempting to compile it myself. When I have more time I want to try your bridge and impliment an autopilot to my radio/map script. I have aerofly broadcast on 255.255.255.255 and 49002 do I have to change that?

    Scott

  • Hi Scott! thanks for your interest, you will see that it will be easy to integrate. Here it is Claude Sonnet 4 answer to your question:

    Hello!

    Great to hear you found our autopilot script useful and that the DLL bridge installation was straightforward. I understand the frustration with compiling from documentation - that's exactly why we created the precompiled DLL to make things easier.

    Regarding your Aerofly broadcast configuration on 255.255.255.255:49002, that's indeed the native UDP stream from the simulator that you mentioned. However, our AeroflyBridge DLL works completely independently and doesn't interfere with that UDP configuration.

    Our bridge uses three separate, independent interfaces:

    1. Shared Memory (for high-performance local applications)
    2. TCP Server on ports:
      • Port 12345: Real-time data stream (JSON)
      • Port 12346: Command channel (JSON)
    3. WebSocket Server on port 8765 (default): For web/mobile applications

    You don't need to change your UDP configuration of 255.255.255.255:49002 - that can continue working normally for your other scripts.

    To connect to our bridge from your autopilot script, you should:

    • Connect via TCP to port 12345 to receive complete JSON data (339+ variables)
    • Use port 12346 to send autopilot commands to the simulator
    • Or alternatively use WebSocket on port 8765 for both functions

    The bridge will give you full access to all autopilot variables like Autopilot.Heading, Autopilot.SelectedAltitude, Autopilot.Engaged, etc., with bidirectional capability to read and control the autopilot.

    Hope this clarifies the difference! If you need specific help integrating the bridge with your radio/map script, I'd be happy to assist.

    Best regards, Juan

  • Hi Scott, this one I think will be more useful to you. Tutorial and sample html file created on the fly, for the user specific requirement. We are really living in a technology revolution, I wonder how the years to come will be.

    Simple Tutorial: Smart Radio Navigator (WebSocket)

    Code for the example, just save it in your pc, run the sim with the DLL in the external_dll folder, and open the html webpage with your browser:

    Smart Radio Navigator (WebSocket) html file

    Best regards, Juan

  • Thank Juan,

    My app has the radio interface working pretty well (not talking back to aerofly at the moment) but my understand is the DLL allows for two way commnication, which would be great for the autopilot. My vision is to improve the app so you can more easily do things in VR via a web app. Not for every plane mostly the small GA planes/helicopters. When I get some more time I will look into your files.

    Thank you for the work you have done.

    Yes with AI, things are changing.

    Scott

  • Two new tutorials were updated, with their source code files.

    Don't take too serious what they do, they are just to explain with examples how to use the DLL.

    Simple Tutorial: Co‑Pilot Checklist Dashboard (WebSocket)


    Python Tutorial: Aircraft Tracker with Interactive Map (TCP)


    Python Tutorial: Flight Data Logger (Python + JSON)

    Best regards, Juan

    Edited once, last by Jugac64 (August 13, 2025 at 9:45 PM).

  • Hi Scott, this one I think will be more useful to you. Tutorial and sample html file created on the fly, for the user specific requirement. We are really living in a technology revolution, I wonder how the years to come will be.

    Simple Tutorial: Smart Radio Navigator (WebSocket)

    Code for the example, just save it in your pc, run the sim with the DLL in the external_dll folder, and open the html webpage with your browser:

    Smart Radio Navigator (WebSocket) html file

    Hi Scott, yes, please take a look at this one, here you will see how to read and write in the COMs and NAVs. I still have to review the one you tested.

    Best regards, Juan

  • In general, please only use the tutorial samples to look at the source code and get the idea on how to do your own integrations, they are not useful applications. For me, there it is not better way to explain things than with examples (at least in coding).

    Best regards, Juan