Jump to content
The simFlight Network Forums

Controlling the position of the User Aircraft


Recommended Posts

I would like to expressly control the user aircraft so that it always appears at the same world position, altitude, pitch and bank as a chosen AI aircraft. In FSX, I tried this by subscribing to the appropriate simulation variables on a per visual frame basis for the AI aircraft, and then setting the same variables on the user aircraft as soon as I got them. To ensure zero latency, I wrote this as a direct in-process dll, sidestepping the tcp/ip and pipe infrastucture. The first results were disappointing. Pitch, bank and altitude were fine, but in terms of world position the user aircraft would "shudder" in respect to the AI aircraft. It appeared on some frames that the AI aircraft had "moved on" before I could set the user aircraft coordinates to match. I suppose this could also be a timing problem also in the asycnhronous nature of the communication between me and FSX.

Perhaps FSUIPC has an approach to doing this, or there is a better way through simconnect. The reason I ask the former question is an application called Traffic View Board can do all this in FS9, and does it very smoothly without any of the problems I am seeing in FSX.

Thanks

Simon

Link to comment
Share on other sites

I tried this by subscribing to the appropriate simulation variables on a per visual frame basis for the AI aircraft, and then setting the same variables on the user aircraft as soon as I got them. To ensure zero latency, I wrote this as a direct in-process dll, sidestepping the tcp/ip and pipe infrastucture.

Unfortunately I don't think it makes any difference whether you are in-process or out, as SimConnect appears to continue to use the same asynchronous communication method. Thшы operates between SimСonnect.DLL and the main routines embedded in FSX's own modules.

The only advantage of in-process operation (apart from the "hacking" opportunity it affords) is in reducing the cost of process switching. The only way to get zero latency would be to hack directly into SIM1.DLL, which is what FSUIPC3 did for FS9 and before. Even then it had to be arranged to only call certain FS routines based on FS's own timer and frame events to avoid recursive corruption in the many non-recursive routines, so it was never truly zero latency.

Perhaps FSUIPC has an approach to doing this, or there is a better way through simconnect. The reason I ask the former question is an application called Traffic View Board can do all this in FS9, and does it very smoothly without any of the problems I am seeing in FSX.

FSUIPC3 did it as explained above. I was assured by Microsoft that SimConnect would provide everything we needed for FSX and beyond, so FSUIPC4 was written only as a compatibility layer, and uses SimConnect for 99% of its interfacing needs.

Many of us were disappointed that SimConnect did not deliver exacting enough features for some types of application, such as the one you are attempting. There's quite a lot of pressure on Microsoft to do something about this in the future, if only for the commercial application via ESP. But for now I'm afraid your only recourse would be to hack into the FS code. SIM1.DLL is the main routine to attack, once you have the right IDs/hadles. It is really heavy going these days with everything now object-oriented C++ with classes within classes withinugh. Tracing pointers down through tables in the heap or only the stack is horrible. When I was younger I would take up the challenge, but no more. Sorry.

Regards

Pete

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.