hbeni / fgcom-mumble

A (flightsim) radio communication simulation based on mumble
GNU General Public License v3.0
17 stars 5 forks source link

Add MSFS 2020 (SimConnect) compatibility #45

Closed hbeni closed 3 years ago

hbeni commented 4 years ago

When the new SDK is released, we could (easily?) add support for MSFS 2020. What is needed is just an interface that takes the simulators plane position and radio configuration and generate UDP packets to the mumble plugin (as per specification).

A quick google said, that maybe msfs2020 is compatible to SimConnect.

That said, it's still open if this compatibility could be reached by this project here, or if it better would be a separate project by its own. I do not own MSFS2020 so probably will never be able to implement this (Help wanted!)


Useful ressources:

It looks like we need: Field Comment
ATC ID is this the multiplayer Callsign?
PLANE LATITUDE lat
PLANE LONGITUDE lon
PLANE ALT ABOVE GROUND altitude AGL
COM ACTIVE FREQUENCY:1 / COM ACTIVE FREQUENCY:2 to get the active frequency
COM TRANSMIT:1 / COM TRANSMIT:2 is this the PTT state?
COM STATUS:1 / COM STATUS:2 to get the COMs status: Radio status flag : -1 =Invalid, 0 = OK, 1 = Does not exist, 2 = No electricity, 3 = Failed (i.E. we could map 0 to COM_PWR=1 and everything else to COM_PWR=0 and leave the serviceable etc at default, which should handle all cases "powered/failed/not-present")
tigert commented 4 years ago

FS2020 uses simconnect, though it is not completely implemented yet. But I think it is complete enough for this purpose.

hbeni commented 4 years ago

OK, then what i found out is, that probably someone needs to make a small bridge application that uses SimConnect to read out the needed values and converts it to FGCom-mumble UDP protocol messages.

That should be simple, yet i lack the development and testing platform for that, so someone else has to step in here unfortunately....

hbeni commented 3 years ago

There is a java library for simconnect: https://github.com/mharj/jsimconnect

  1. I think a nice way to go would maybe an integraton into the RadioGUI, where the GUI slaves itself to a SimConnect connection and adjusts the internal data as like the user clicked it together (so we can see visually in the GUI what data SimConnect had read out). Other than that the RadioGUI could stay the same, especially the bridging to the fgcom UDP protocol would be automatic.
  2. Alternatively we could just provide a small java bridge application that just handles the Simconnect connection/readout and the translation to fgcom-UDP packets (which could reuse the already coded client).

@mharj: you don't happen to have code already to continuously read out the following properties via Simconnect, do you?

Maybe you have time to code up a starting point for me, that i can integrate into my project? (I unfortunately can't make sense of the simconnect stuff, nor can I test it, so I'm unable to succeed on this on my own...)

hbeni commented 3 years ago

I made a new experimental branch. No idea if it works, tough: simConnectSupport

For testing: FGCom-mumble-radioGUI-0.9.0-jar-with-dependencies.jar.zip

mharj commented 3 years ago

@hbeni I don't have any examples atm for those (but I remember that position was relatively easy to read). Code itself is just original copy from lc0277 site with permission, so it's easier to work/clone in github.

hbeni commented 3 years ago

@mharj Thanks Marko, for the response! I coded up some test code yesterday. I am very unsure if i did it right, but at least it's a start to test. The interesting bits are in the class SimConnectBridge.

Do you have MSFS2020 and want to give it a shot? (just run the jar, open the RadioGUI menu option, slave it to SimConnect and see if the values are synced with MSFS?)

hbeni commented 3 years ago

And it might very well be, that i need to read in a loop - is this correct?

I think this might be just a one-shot read attempt? https://github.com/hbeni/fgcom-mumble/blob/423bdc9f487e6f53c8a8e699b46f03a9ca9ae162/client/radioGUI/src/main/java/hbeni/fgcom_mumble/SimConnectBridge.java#L104-L112

hbeni commented 3 years ago

Added a new test: FGCom-mumble-radioGUI-0.9.0-jar-with-dependencies.jar.zip It requests data in a 100ms loop now (i hope)

hbeni commented 3 years ago

Added a new test: FGCom-mumble-radioGUI-0.10.0-jar-with-dependencies.jar.zip It adds Config options to define the SimConnect connection parameters