SIMCONNECT SDK
The SimConnect SDK can be used by programmers to write add-on components that communicate with Microsoft Flight Simulator 2024. Both in-process modules and out-of-process executables have access to the SimConnect API, noting the following:
- Out-of-process add-on components for Microsoft Flight Simulator can be written in C, C++, or - if the managed API calls are being used - any .NET language such as C#.net or VB.net.
- In-process modules are written in C++ and compiled into WebAssembly modules.
Typically the components and modules using the SimConnect SDK will perform one or more of the following:
- Add the processing for a new complex gauge, or other instrument, to Microsoft Flight Simulator 2024.
- Replace Microsoft Flight Simulator 2024 processing of one or more events with new logic.
- Record or monitor a flight.
- Extend the mission system of Microsoft Flight Simulator 2024.
- Create and set the flight plans for AI (non-user) aircraft.
- Enable new hardware to work with Microsoft Flight Simulator 2024.
- Control an additional camera that the user can optionally select to view.
- Communicate with other SimConnect clients.
The pages available in this section are:
You can find information on how you can use the DevMode SimConnect debug tool to help you find issues and errors with your SimConnect apps here:
You can also find additional helpful information from the following pages:
Finally, there are some pages relating to legacy files that could be used for configuring and debugging SimConnect client/server communications (these files can still be used, although it's not recommended any longer and the functionality may be removed or changed in the future):
Upgrade SimConnect from MSFS 2020 to MSFS 2024
There is no big breaking change that needs a lot of work to be compatible with Microsoft Flight Simulator 2024. Recompile a SimConnect module with the new header provided by the MSFS 2024 SDK will automatically use the new feature. If a SimConnect module is compiled with the old MSFS 2020 SDK, it will be detected as a MSFS 2020 module and will work as it used to be. Here is a list of small changes that need your attention :
- To handle helipad ident, the size of the ident member of various structures has been incresed to 8 (SIMCONNECT_ICAO, SIMCONNECT_DATA_FACILITY_AIRPORT and their dependencies). Depending of the module implementation, some logics must be reviewed to work with the size of the new structures (especially if you use static buffer).
- All members of SIMCONNECT_CONTROLLER_ITEM are now used.
Setup
This section describes how to set up a working development environment for SimConnect.
WebAssembly Modules
WebAssembly modules can use SimConnect internally, provided as part of the SDK. It is only required to include "SimConnect.h"
. More information in WebAssembly modules.
C/C++ Projects
To build SimConnect add-ons, the recommended Visual Studio version is Visual Studio 2019, with a minimum version of 2005. To build the project, make sure you have completed the following steps.
For out-of-process applications, start a new Console Application project if the add-on will have no user interface. Start a new MFC Application if the add-on will have a user interface. In either case, set the platform as x64
. In order to use the SimConnect functionality, it is required to include the SimConnect.h
header file.
include "SimConnect.h"
The dependencies can be either configured Using the Property Manager, or via Manual Configuration.
Using the Property Manager
The SDK now provides Visual Studio property sheet. It can be included in:
Property Manager -> (select project) -> Add Existing Property Sheet
And selecting the Property Sheet provided in the SDK:
$(MSFS2024_SDK)\SimConnect SDK\VS\SimConnectClient.props
Manual Configuration
Alternatively, the configuration can be performed manually, by performing the following steps:
- Add the SimConnect include folder (
$(MSFS2024_SDK)\SimConnect SDK\include
) to theAdditional Includes
:
- Add SimConnect from the library directory (
$(MSFS2024_SDK)\SimConnect SDK\lib
) to theAdditional Library Directories
:
- Link to the
SimConnect.lib
library, by adding the following dependencies toAdditional dependencies
:SimConnect.lib
shlwapi.lib
user32.lib
Ws2_32.lib
- Build the application using the function calls described in this document.
C# / .NET / VB.NET Projects
For C#, or other .NET language add-ons, refer to the special section on Programming SimConnect Clients using Managed Code, but general procedure is:
- Build the application using the function calls described in this document.
- An example is given with the SimvarWatcher sample.
Design Considerations
The design of a SimConnect add-on involves writing a client to communicate with a server running within Microsoft Flight Simulator 2024. The client opens up communications with the server, then requests that certain events and certain object information is passed to it. The client then waits for the information to be received from the server, and then processes it appropriately.
The recommended method of writing an add-on is to build it out-of-process as an application (an .exe
file) rather than in-process (a WASM module). This is because out-of-process applications provide more stability, if they crash they typically will not crash Microsoft Flight Simulator 2024, and they are easier to build, test and debug. Out-of-process also supports managed code, and therefore applications can be written in .NET
languages with their rich support for objects and ease of building the UI. SimConnect clients are not currently thread-safe.
SimConnect makes extensive use of ID numbers defined by the client. There are ID numbers for requests, data definitions, events, groups, and so on. These ID numbers should be unique for the client. Re-using an ID will result in the previous call using that ID becoming obsolete, and thus being ignored by the server.