Board index FlightGear Development New features

Synchronization between 2 pc is not reliable

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Synchronization between 2 pc is not reliable

Postby selmane » Tue Jun 06, 2017 1:46 pm

I use 2 pc:
With the following commands:
pc1:
--native-FDM =socket,out,50,192.168.1.52,5510,udp
--native-ctrls =socket,out,50,192.168.1.52,5511,udp
pc2:
--native-FDM =socket,in,50,5510,udp
--native-ctrls =socket,in,50,5511,udp
When I do simple flight it works well, but my problem when I make a shot in the master pc (with the "e" button) it works but only in the master !!!
the pc (slave) don't see the fire and missiles ...!

Master:

Image
Slave:

Image

Knowing that when I do shooting (FG change / controls / armament / trigger: false -> true) only in the master pc .

An idea please!!!
selmane
 
Posts: 7
Joined: Mon Jun 05, 2017 11:03 am
Version: 2017.1.2
OS: Windows 10

Re: Synchronization between 2 pc is not reliable

Postby erik » Thu Jun 08, 2017 10:46 am

Those effects are all added after the synchronization protocol. To be honest I am not even sure they were ever tested with them.
The normal use case was to create a real flight simulator setup which doesn't need those effects.

Now, since multiplayer should be able to handle them, maybe you could active that too?

Erik
erik
 
Posts: 1520
Joined: Thu Nov 01, 2007 1:41 pm

Re: Synchronization between 2 pc is not reliable

Postby selmane » Thu Jun 08, 2017 10:47 pm

I tried to make a protocol: (newp.xml) :
Code: Select all
 <?xml version="1.0"?>
 <PropertyList>
 <generic>
    <output>
  <line_separator>newline</line_separator>
   <var_separator>:</var_separator>
      
      <chunk>
        <name>trigger</name>
           <node>/controls/armament/trigger</node>
           <type>bool</type>
         </chunk>
 
        <chunk>
       <name>trigger1</name>
           <node>/controls/armament/trigger1</node>
           <type>bool</type>
         </chunk>

    </output>
   
   <input>
  <line_separator>newline</line_separator>
   <var_separator>:</var_separator>
      
      <chunk>
       <name>trigger</name>
           <node>/controls/armament/trigger</node>
           <type>bool</type>
         </chunk>
 
        <chunk>
       <name>trigger1</name>
           <node>/controls/armament/trigger1</node>
           <type>bool</type>
         </chunk>
   </input>
   
  </generic>
 </PropertyList>


Image


And I launched flightgear with the following commands:

Pc1:(master)
--native-fdm=socket,out,50,192.168.1.52,5510,udp
--native-ctrls=socket,out,50,192.168.1.52,5511,udp
--generic=socket,out,50,192.168.1.52,5512,udp,newp

Pc2:(slave)
--native-fdm=socket,in,50,,5510,udp
--native-ctrls=socket,in,50,,5511,udp
--generic=socket,in,50,,5512,udp,newp

I also tried :(slave)
--native-fdm=socket,in,50,,5510,udp
--native-ctrls=socket,in,50,,5511,udp
--generic=socket,in,50,192.168.1.52,5512,udp,newp

***
I also tried :(slave)
--native-fdm=socket,in,50,,5510,udp
--native-ctrls=socket,in,50,,5511,udp
--generic=socket,in,50,192.168.1.1,5512,udp,newp


But no results!!!
selmane
 
Posts: 7
Joined: Mon Jun 05, 2017 11:03 am
Version: 2017.1.2
OS: Windows 10

Re: Synchronization between 2 pc is not reliable

Postby Richard » Fri Jun 09, 2017 4:24 am

That's not going to work like that because it's using the properties for the player model and not the multiplayer model. So if it did work the result would be the equivalent of firing the missiles on the player craft not the multiplayer craft.

The multiplayer model is loaded into the /AI/models/multiplayer[x] - and only the model is loaded not the entire aircraft-set.xml. The model needs to load all of the appropriate Nasal and any other required items (properties that are in the -set.xml etc) as part of the model startup.

The OPRF (http://opredflag.shivtr.com/forum_threads/2412191) versions the F-15, F-14, Viggen (and probably more) have the required logic to show missiles over MP.

To work over MP properly the model needs to use the existing property transfer over MP (e.g. in sim/multiplay/generic/).

The best and possibly easiest way to do this is using Emesary with a multiplayer bridge to transmit this (transparently) using a GeoEventNotification.

This is a standard notification that is used to tell all players on MP about something that happened at a specific location.

In one craft (call this model A) you can do this

Code: Select all
cargo_dropped = new GeoEventNotification(params);
emesary.GlobalTransmitter.NotifyAll( cargo_dropped )


To handle the notification of cargo dropped you'd have something like this.

Code: Select all
var CargoDropRecipient =
{
     new: func(_ident)
     {
         var new_class = emesary.Recipient.new(_ident);

         new_class.Receive = func(notification)
         {
             if (notification.NotificationType == "GeoEventNotification") {
                 # Logic to handle the creation of a submodel
                 return emesary.Transmitter.ReceiptStatus_OK;
             }
             return emesary.Transmitter.ReceiptStatus_NotProcessed;
         }
         return new_class;
     }
};

CargoDrop_recipient = CargoDropRecipient.new("CargoDropRecipient");
emesary.GlobalTransmitter.Register(CargoDrop_recipient);


To bridge the notifications over multiplayer the following is required
Code: Select all
var routedNotifications = [notifications.GeoEventNotification.new(nil)];
var outgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("F-14mp",routedNotifications, 19, "");
var incomingBridge = emesary_mp_bridge.IncomingMPBridge.startMPBridge(routedNotifications);


What's going to happen is that when the model sends the notification via the GlobalTransmitter the outgoing bridge will take care of transmitting the Notification over multiplayer. In the remote multiplayer version of the craft the Notification will simply arrive inside the GlobalTransmitter exactly as though it was sent inside the multiplayer model - just with the data from the remote model that will arrive at your CargoDropRecipient no difference whether it is you doing the cargo drop, or someone else; it is transparently sent over MP in such a way that your code does not need to know where the notification has come from.

However the recipient needs to handle the logic to create and manage the submodels (not shown in the example above because it's implementation dependent).
Richard
 
Posts: 706
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: Synchronization between 2 pc is not reliable

Postby selmane » Fri Jun 09, 2017 9:12 am

For my case, I want to use the second pc (slave) as a co-driver.
So the 2 pc in the same plane that's why i do not see the multiplayer is not the right solution !
Last edited by Johan G on Sun Jun 11, 2017 2:12 pm, edited 1 time in total.
Reason: Please do not quote the entire preceding post; it is right above yours.
selmane
 
Posts: 7
Joined: Mon Jun 05, 2017 11:03 am
Version: 2017.1.2
OS: Windows 10

Re: Synchronization between 2 pc is not reliable

Postby Alant » Fri Jun 09, 2017 1:15 pm

Have you checked that the properties exist, and are bing updated in the slave pc?

Alan
Alant
 
Posts: 912
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Synchronization between 2 pc is not reliable

Postby Richard » Fri Jun 09, 2017 1:50 pm

selmane wrote in Fri Jun 09, 2017 9:12 am:For my case, I want to use the second pc (slave) as a co-driver.
So the 2 pc in the same plane that's why i do not see the multiplayer is not the right solution !


I tend to think that multiplayer is the right solution; but more about that later.

What you're attempting is not going to work quite as you imagine. Even if you managed to sync the properties the rest of the aircraft is going to act as a separate simulated entity; possibly in a different position etc.

On the master PC you need the complete model (i.e. what it currently is). This needs to be modified to transmit (via whatever method you like) all properties that are relevant; if the aircraft has a well defined flight recorder configuration this will be the minimum.

On the slave machine you need a different version of the model; one that doesn't have any of the simulation models, but instead takes the properties from the master via the transmitted data. You will also have to modify this, so that any control inputs, switches etc, are transmitted back to the master.

Normally multiplayer is used to do this; with no 3d model at all, instead when connected to the master machine the viewpoint is simply moved to the appropriate place *in the other aircraft* that is transmitted normally via mp. A well configure MP craft will already transmit most of the important properties; so all you have to do is to create a way of transmitting back control inputs to the master craft over multiplayer. There is already a way of doing this using the dual-control.nas module.

In any event both machines should have their frame rates set so that they can achieve a consistent frame rate; as fluctuating frame rates make it harder to avoid lag and jitter. You can use a local multiplayer server to reduce lag, and increase the transmission frequency - the packets are 1200bytes maximum so on a lan you should be able to transmit these at a decently high rate.
Richard
 
Posts: 706
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: Synchronization between 2 pc is not reliable

Postby Hooray » Sun Jun 18, 2017 5:34 pm

For additional background info on "Emesary", refer to: http://wiki.flightgear.org/Emesary
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am


Return to New features

Who is online

Users browsing this forum: No registered users and 9 guests