- Messages
- 531
- Country
Hi Developers,
I would like to ask a general question about memory sharing in MSFS, I mean the way several instruments can share information. Let me explain...
In FSX/P3D, the gauges used to be DLLs, and you could have all the gauges of an aircraft grouped into a single DLL (what I usually did). When the aircraft was loaded in the sim, the DLL was loaded and executed in the same memory space as the sim. Anyway, it meant that several parts of the DLL could share information because they were in the same memory space. For example, the flight plan that was composed of all the route waypoints could easily be shared between the FMC, which displays the flight plan as a list, and the Navigation Display (or the Multi-Function Display) that was drawing the route on the screen. That was easy.
In MSFS it is different because each instrument is completely independent form the others. This is what I noticed when developing instruments in JavaScript (I didn't try WASM but I guess it is the same). If we take the same example, the flight plan information cannot be shared between the FMC and the ND/MFD. If you use the standard MSFS flight plan, that's fine because MSFS provides a way to read this information, so both the FMC and the ND/MFD can read it, they will both read the same information. But what if you want to create you own custom flight plan with your own data structure? Or what if you want to share any other kind of custom information between instruments?
I know you can use L: vars for this, this is fine for simple information, but it may not be the right solution for complex information such as a flight plan or any other structured information. I am not even sure a L: var can handle a string. If so, how can we share a string between 2 instruments?
If I missed something in the SDK, I would be glad to know
Thanks,
Eric
I would like to ask a general question about memory sharing in MSFS, I mean the way several instruments can share information. Let me explain...
In FSX/P3D, the gauges used to be DLLs, and you could have all the gauges of an aircraft grouped into a single DLL (what I usually did). When the aircraft was loaded in the sim, the DLL was loaded and executed in the same memory space as the sim. Anyway, it meant that several parts of the DLL could share information because they were in the same memory space. For example, the flight plan that was composed of all the route waypoints could easily be shared between the FMC, which displays the flight plan as a list, and the Navigation Display (or the Multi-Function Display) that was drawing the route on the screen. That was easy.
In MSFS it is different because each instrument is completely independent form the others. This is what I noticed when developing instruments in JavaScript (I didn't try WASM but I guess it is the same). If we take the same example, the flight plan information cannot be shared between the FMC and the ND/MFD. If you use the standard MSFS flight plan, that's fine because MSFS provides a way to read this information, so both the FMC and the ND/MFD can read it, they will both read the same information. But what if you want to create you own custom flight plan with your own data structure? Or what if you want to share any other kind of custom information between instruments?
I know you can use L: vars for this, this is fine for simple information, but it may not be the right solution for complex information such as a flight plan or any other structured information. I am not even sure a L: var can handle a string. If so, how can we share a string between 2 instruments?
If I missed something in the SDK, I would be glad to know

Thanks,
Eric