Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI aircraft twitches when flying in formation #86

Open
aalbertmate opened this issue Feb 5, 2023 · 4 comments
Open

AI aircraft twitches when flying in formation #86

aalbertmate opened this issue Feb 5, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@aalbertmate
Copy link

Describe the bug
AI aircraft twitches when I get closer in formation, while replaying my flight track.

To Reproduce

  1. Recorded the flight
  2. Formation
  3. Replay
  4. Fly WITH formation

Expected behavior
The AI should have a smooth movement instead of lagging and twitching.

Application version:

  • Version ["Flamboyant Fokker" (2023.02)
    Version 0.15.0 (67cb995)
    Thu Feb 2 17:44:06 2023]

Thank you!
FlightSimulator 2023-02-05 12-50-49-457

@till213
Copy link
Owner

till213 commented Feb 5, 2023

Yes, this is - unfortunately - known as "aircraft jitter" (since the FS X day even) for AI aircraft, and documented in the "known issues".

The good news: I have some idea (based on some older SimConnect developer forum entries of the "old days" (< MSFS) how to improve AI aircraft replay. Whether it'll work (also with MSFS) we only know once implemented.

I change this into an "enhancement" ticket, as it requires me to write additional code (and the existing code is technically not "defect": it just doesn't work as well - inside MSFS - as expected).

@till213 till213 self-assigned this Feb 5, 2023
@till213 till213 added the enhancement New feature or request label Feb 5, 2023
@Orishek
Copy link

Orishek commented Apr 26, 2024

Any news about this issue? Planes jittering makes close-formation flying terrible :(

@till213
Copy link
Owner

till213 commented Apr 28, 2024

Not as far as the AI aircraft jitter is concerned, no. However I have just restarted with implementation of the upcoming Sky Dolly v0.17 - as a general remark.

I am sorry for the delay, but "life has happened" recently.

That being said, I still have some ideas that could improve the AI replay. The AI aircraft "jitter" is by the way a problem known since the FSX days and both due to the "asynchronous nature" of the SimConnect API (but simply being "asynchronous" does not explain the "jitter" alone: "asynchronous" simply means the data comes and goes "a bit later" than the actual request), but perhaps also because MSFS might sometimes "down-prioritise" the processing of SimConnect requests, specifically for AI aircraft.

One published solution back in the days was to use "slew mode", also for AI aircraft. That means you simply give the velocity (direction + speed vector) and the aircraft would constantly move autonomously - until the next velocity is transmitted, pointing the aircraft towards the next desired waypoint (of the recorded path, or e.g. "pointing at a waypoint 2 seconds away").

The problem with "slew": it disables all simulations, so the aircraft won't even react to flap settings, no sound, no visual effects... this could be acceptable for AI aircraft, but not optimal at all. Also, the "slew factor" has to be calibrated to the actual desired "meters per second" (= the desired real world velocity), it has a maximum value of 16383 that corresponds to I don't know what maximum speed etc.

Of course the SimConnect API also offers to modify velocity simulation variables for the aircraft:

https://docs.flightsimulator.com/html/Programming_Tools/SimVars/Aircraft_SimVars/Aircraft_Misc_Variables.htm

but those are in relation to the aircraft local coordinate system. Assuming for now that the X-axis is pointing "forward" (flight direction) then setting VELOCITY BODY X to the desired feet/s would sound promising... but when the aircraft nose was pointing "up" during some landing approach the aircraft would fly "up" as well. What we would want is to set the desired velocity in world coordinates, but those are not even in the documentation anymore (they used to be there, even documented as "writeable", but doing so never had any effect on the aircraft - so I guess Asobo has now updated the documentation accordingly, by simply removing them).

So this is as far as I got - on a theoretical level. But I will keep on looking into this, after having polished a few other existing features (including replay, auto-sample rate and trying different interpolations (different cubic splines)).

@till213
Copy link
Owner

till213 commented Apr 28, 2024

Oh and I took great interest in the Airshow Assistant:

https://msfs.touching.cloud/mods/airshowassistant/

The controlled AI aircraft follow smoothly the user aircraft. The difference: this addon works as "in process" addon, that is it runs "within MSFS" itself (but also using the SimConnect API, as it seems).

This could give such in-process addons an advantage in that they are really getting the latest data and are reliably invoked for every "simulated frame" (while Sky Dolly also reacts to the "simulated frame" event there is no guarantee that MSFS will also react in time to the subsequent SimConnect requests - there is "no service guarantee" ;)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants