Jump to content
The simFlight Network Forums

LVARs and shared cockpit in P3D


Recommended Posts

Good morning,

My app uses LVARs to read/write to Prepar3d, allowing gauges to read the LVARs and show failure flags. It works very well, except, in shared cockpit multiplayer as it appears local variables are truly only local. Any idea how to synchronize LVARs across multiple computers with shared cockpit? There are approximately 50 LVARs to keep in sync. Would I have to store each value in a seperate offset then have a client app to read it and process the LVARs on the individual computers? Seems like there's probably an easier way?

Thanks,

Robert

Link to comment
Share on other sites

Hi Robert,

I don't know anything about the P3D shared cockpit feature, but it sounds like these particular variables are not getting shared between the copies of P3D. I guess P3D can't share everything due to bandwidth, especially if you're using third-party aircraft.

Quote

Would I have to store each value in a seperate offset then have a client app to read it and process the LVARs on the individual computers?

FSUIPC itself doesn't do any cockpit sharing so offset values will also not be shared unless they are backed by P3D data that is shared. So writing to spare offsets on one copy of P3D will not be seen on the other.

I don't think there's an easy way to do this. You'll need to come up with a way to pass the data between the two PCs yourself.

The obvious way is probably to use a TCP link between your application running on the the server and the client(s) and pass the LVAR data between them. .NET has a TcpClient and TcpListener class. Your application can then exchange the LVAR data over the TCP link and update the local copies of the LVARs using FSUIPC.

There might be some .net libraries that make data exchange easier than writing your own networking code, but I've never looked into this.

Paul

 

Link to comment
Share on other sites

Paul,

Thank you very much for your response. That's what I ended up doing! Since my program was already sending network packets, I'm just sending the flags across the network whenever they change, and other copies of the software listen for the flags and update their local LVARs. So far, works really well.

Thanks again Paul!

Robert 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.