TwinFan / XPMP2

Multiplayer library for X-Plane 11/12 with instancing, TCAS override, and sound
https://twinfan.github.io/XPMP2/
Other
24 stars 16 forks source link

WIP: Real aircraft's behaviour #11

Closed unclesal closed 4 years ago

unclesal commented 4 years ago

Dear Sir! Please take a look for changes. If you do not mind, then I would like to make the behavior of aircrafts more real. I tried to fit your programming style. And I apologize for my English. I solemnly and really swear that I will improve it if we will work together. WIP mean "work-in-progress", but I would like ask you to see it and I want ask you, have you any interest for this topic or not. The goal is to make aircraft behavior closer to reality. And also to calculate aircrafts's positions during the intervals between receiving it from upper-side software by network. I think it must be in the library, not in upper side software. Thanks for pay attention.

TwinFan commented 4 years ago

Thanks for your contribution! I understand from the code that you are not actually moving the aircraft position, but its configuration like gear, flaps, lights etc.

I can agree with passing on elapsedTimeSinceLastCall to UpdatePosition() and will provide that shortly.

However, I will not merge the code at the current stage:

That is actually what I suggest as a path into the future: Provide a separate class that offers to handle actuator movement. In two separate files, a header file and an implementation. This way the code streams are clearly separated and hence is risk: Updates to your class would be no risk to the core functionality. If you really need a change upstream (like the elapsedTimeSinceLastCall) we can certainly talk about that.

Some more hints on that actual functionality: LiveTraffic has all that for gears, flaps, reverses. It is called MovingParam and found in its LTAircraft.cpp file. LiveTraffic also has logic to configure parameters like gear extension time in a configuration file. That alone isn‘t simple as you don‘t want to handle that on ICAO a/c type level but need some aggregation/grouping level.

LiveTraffic doesn‘t do MovingParam for lights...I don‘t think that any CSL model makes a difference; I think they only switch on or off if the dataRef is above or below 0.5.

For flaps, slats, spoilers you would also need to provide a way of extending them partly.

unclesal commented 4 years ago

Good time of day.

that you are not actually moving the aircraft position

Yes. Because I wanted to know first whether you were interested in such changes or not. I mean generally, at all, not for current release, nor immediatelly. I have heard the answer is "no". No problem, I will delete the PR tomorrow, when you have read this message. I want to thank you again for your payed attention and for adding elapsedSinceLastCall.

a separate In two separate files, a header file and an implementation.

Good way. This is possible for now.

It is called MovingParam and found in its LTAircraft.cpp file.

Thaks for advision, I will study it. May be you already released all what I need to. Thank you again and good luck.