Closed TwinFan closed 3 years ago
Technical proof of concept done: The plugin "XPMP2 Remote Client" receives aircraft information from other XPMP2-based plugins and displays planes using the same CSL model at the same location and attitude.
Some selected Log.txt
lines involving the new "XPMP2 Remote Client", displaying the 3 circling planes of two XPMP2 Sample-Plugins, one locally, one remotely. Local machine is a Mac, remote machine is a Windows PC:
2:10:51.929 XPMP2_RC: XPMP2 Remote Client 0.01 starting up...
2:10:51.929 RC/XPMP2 DEBUG Remote.cpp:563/RmtRecvMain: Receiver started listening to 239.255.1.1:49788
...
2:10:54.175 XPMP2-Sample/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x000001: Instance created
2:10:54.175 XPMP2-Sample/XPMP2 DEBUG Remote.cpp:428/RmtSendMain: Listening to 239.255.1.1:49788, waiting for someone interested in our data...
2:10:54.175 XPMP2-Sample/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x123456: Instance created
2:10:54.175 XPMP2-Sample/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0xABCDEF: Instance created
2:10:54.175 XPMP2-Sample/XPMP2 INFO Remote.cpp:460/RmtSendMain: Received word from 192.168.178.71:31938, will start sending aircraft data
2:10:53.828 XPMP2_RC DEBUG Client.cpp:237/ClientProcSettings: Received settings from XPMP2-Sample (4) @ 192.168.178.36:31938
2:10:53.828 XPMP2_RC INFO Client.cpp:248/ClientProcSettings: First data received from XPMP2-Sample @ 192.168.178.36:31938
2:10:56.076 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x000001: Instance created
2:10:56.116 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0xABCDEF: Instance created
2:10:56.140 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x123456: Instance created
...
2:11:11.184 XPMP2_RC DEBUG Client.cpp:237/ClientProcSettings: Received settings from XPMP2-Sample (5) @ 192.168.178.71:31938
2:11:11.184 XPMP2_RC INFO Client.cpp:248/ClientProcSettings: First data received from XPMP2-Sample @ 192.168.178.71:31938
2:11:11.958 RC/XPMP2 DEBUG Aircraft.cpp:204/Create: Replaced duplicate _modeS_id 0x000001 with new unique value 0x000002
2:11:11.958 RC/XPMP2 DEBUG Aircraft.cpp:204/Create: Replaced duplicate _modeS_id 0x123456 with new unique value 0x000003
2:11:11.958 RC/XPMP2 DEBUG Aircraft.cpp:204/Create: Replaced duplicate _modeS_id 0xABCDEF with new unique value 0x000004
2:11:11.958 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x000003: Instance created
2:11:11.958 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x000004: Instance created
2:11:12.096 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0x000002: Instance created
I've also recompiled LiveTraffic (no code change necessary at all) and had it feed the busy traffic at KLAX...also works!
0:00:00.000 XPMP2_RC: XPMP2 Remote Client 0.01 starting up...
0:00:00.000 RC/XPMP2 DEBUG Remote.cpp:563/RmtRecvMain: Receiver started listening to 239.255.1.1:49788
...
0:02:05.140 XPMP2_RC DEBUG Client.cpp:237/ClientProcSettings: Received settings from LiveTraffic (3) @ 192.168.178.36:31938
0:02:05.140 XPMP2_RC INFO Client.cpp:248/ClientProcSettings: First data received from LiveTraffic @ 192.168.178.36:31938
0:02:11.444 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0xA8B939: Instance created
0:02:11.444 RC/XPMP2 DEBUG Aircraft.cpp:573/CreateInstances: Aircraft 0xA97A67: Instance created
Don't worry...there's still a bit to go, especially more efficient position updates (currently it's only using full-details message for each position update) and handling of animation dataRefs, which aren't transferred at all at the moment, lot's of special situation handling (currently the planes never go away ;-) )...
Works, (bad quality) video available showing how planes move swiftly between screens.
@HellGL, would you be interested in Beta testing? If so, please contact me on Discord (TwinFan#7161, preferred, beta testing is coordinated in a channel of the LiveTraffic server), or via private message on X-Plane.org. I would appreciate the help!
Todo list after 8 hour overnight test with 2 X-Plane instances runnin a cross-feed scenario (ie. both instances send and receive: Win as Master, running LiveTraffic at KLAX, XPMP2-Sample, and XPMP2 Remote Client; Max as External Visual running XPMP2-Sample and XPMP2 Remote Client)
8:14:11.594
. Error messages unable to send broadcast are then expected and OK. But a reconnect via WLAN (different interface!) is not recognized. Suggested solution: Upon exception stop broadcasting altogether and start over so the multicast network object has a chance to reconnect via a different network interface. Need a retry-mechanism, ideally one which retries in growing time periods.8:15:10.711
, X-Plane complains about Remote Client being "buggy". Is said "to turn off the Map layer for other planes, but it is not controlling the other planes", which I don't evenknow what that means, and "tried to control TCAS while not owning the AI planes". At that point the Remote Client had already ceded AI control (a few lines earlier in the log), so it is true that it doesn't own the AI planes...but I would need to figure out what it tries to do during shutdown that is not allowed here. This sequence of errors did not appear on the PC side.I started my test yesterday with 4 clients and had massive problems in my network. After tracking the problem for one day it comes down to XPMP2 flooding the network with short (8 bytes of data, all the same) UDP multicast messages to 239.255.1.1:49788 (>100000 packets per second). Did anybody experience a similar problem? Maybe not even noticing it as a problem, because it just increases network load? Here it caused my networked hardware to loose connection which I immediately recognize.
Current Situation / Problem In a networked multi-PC setup several only loosely coupled instances of X-Plane run in parallel, usually to drive different screens. Running LiveTraffic or any other XPMP2-based plugin will not guarantee that all planes are always fully aligned and placed at the exact same location. This will look ugly when planes move across screens driven by different PCs.
Suggested Solution Synchronize plane objects across the network, driven by a master. Basic design ideas:
Resources/XPMP2.example.prf
Benefits Better looking support for a networked setup
Additional context Originally discussed as issue TwinFan/LiveTraffic#126, but now decided to be solved centrally in XPMP2 and hence moved here.