Inaccurate LAT/LON/ALT update of non-ATC AI aircraft

MSFS Version: 1.1.9.0
SDK version: 1.0.0
VisualStudio: 2022
Frequency: Consistently
Severity: High

Bug description:

I have a Marketplace product - AirshowAssistant, which uses AI aircraft as an effects and visible accessories container. Each frame module WASM script applies user aircraft position, attitude and velocity to the AI aircraft so it appear in exactly same position as the user aircraft.

In MSFS2020 it works almost perfectly - small deviation during hard turns but it is acceptable. In MSFS2024 AI aircraft with the very same code unstable and pops in random position behind user aircraft.

I had several guesses about issue, but after a day of experiments I wasn’t able to find the root of the problem. Somehow applying position variables constantly creates some sort of jittering, it may look like latitude and longitude get/set variables has low accuracy (float instead of double), but this does not happen when you taxi on the ground so shouldn’t be the case.

This issue depend on the velocity and became noticeable at 50m/s or higher.

Legacy gauges functions used to get user data (aircraft_varget). As attempt to eliminate incorrect user aircraft position values, I have subscribed to user data with SimConnect_RequestDataOnSimObject and received lat/lon/alt values each frame. Result the same but even worse as additional 1 frame delay appear. Attempt to use new VARS API failed as WASM crashed (applied as separate bug report).

Workaround is apply position only 1-2 times per second. It does not create jittering but makes AI aircraft position inaccurate, which is not perfect.

Repro steps:
Load StandaloneModuleProject
Choose FA-18, start the flight in any location
During flight, change flaps position to select different modes:
Flap #0 position and velocity applied every frame
Flap #1 position applied once per second, velocity - every frame
Flap #2 position applied every frame, no velocity set

Flap #0 is correct way of AI aircraft data update, but result is below acceptable level due to high position error relative to user aircraft.

Attachments:

in private message

2 Likes

I suspect this is because of WASM being on a separate thread now. We are observing a similar issue with sim vars we use on a project we’re working on.

1 Like

Input events are also slow and weird in fs24.
I wonder if that’s related.

1 Like

Possibly, yes. I have expected several frames delay to appear, but not such unstable behaviour. Hope can be fixed/improved.