Moving Aircraft with SIMCONNECT_DATA_INITPOSITION causes freeze

Version: 1.3.23.0

Frequency: Consistently

Severity: High

Bug description:

I searched for any duplicates but could not find any.

There is a freeze when using SimConnect_SetDataOnSimObject and SIMCONNECT_DATA_INITPOSITION. If you go to the MSFS 2024 SDK Samples and load the SetData project, once you move the aircraft the entire simulator freezes (but it is not crashed). If you “teleport” back to another location, for example, where you started, it may unfreeze the sim. It appears to be based on where you are moving to. If you are already close to the location you are moving to (e.g. 5 miles), there is no freeze. When frozen, you cannot go back to the simulator menu, cannot interact with the cockpit, there are no animations such as the propeller, but you can look around. I ran the same test in MSFS 2020 and there is no freeze. It appears to be MSFS 2024 specific.

Repro steps:

It is very easy to reproduce. Setup somewhere far from the location, such as the east coast of the USA. Then use the sample code from the SDK SetData project to move to Washington. The simulator will freeze.

                    SIMCONNECT_DATA_INITPOSITION Init;
                    Init.Altitude   = 5000.0;
                    Init.Latitude   = 47.64210;
                    Init.Longitude  = -122.13010;
                    Init.Pitch      =  0.0;
                    Init.Bank       = -1.0;
                    Init.Heading    = 180.0;
                    Init.OnGround   = 0;
                    Init.Airspeed	= 60;
                    hr = SimConnect_SetDataOnSimObject(hSimConnect, DEFINITION_6, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(Init), &Init );

                    printf("\nEVENT_6 received and data sent");

Hi,

I confirmed this error with several applications that allow you to move to a different location via SimConnect. The simulator ends up on a frozen state that sometimes requires you to exit the simulator.

I am curious if this is something that will get addressed, or would we need to instruct our customers on a workaround, such as place their aircraft close to the teleport location before teleporting which seems to not cause the freeze state.

Edit: After further testing, it is hit or miss. At times it might work, at other times it will lock the sim up until you have to use task manager to close it, or free it by teleporting to another location…

A feature of our application we want to upgrade to MSFS 2024 is how you can re-use multiple scenarios via SimConnect. This SimConnect feature works fine in MSFS 2020.

I can’t confirm the same behaviour

I have an utility application to grab msfs terrain dem in order to match my lifts location, this is the basic function I use to move the airplane where I want to obtain the data,
I’m able to teleport in all part of the world without any hiccups, at distance ranging from zero to thousand of kilometers
(With the only drawback to have to wait the scenery loading to later sample terrain…it would be cool to have a variable with the “loading” percentage)

Also have a client that use another implementation of the teleport without any issue (and because of the amount of data, everything is automated and must not freeze or stop at anytime)

Public Async Function moveToLocation(lat As String, lon As String, alt As String) As Task

    Dim position As StructAircraftPosition
    position.latitude = Val(lat)
    position.longitude = Val(lon)
    position.altitude = Val(alt) * 3.28 + 300
    position.heading = 0
    position.pitch = 0
    position.bank = 0

    If msfs_simConnect IsNot Nothing Then
        Try
            msfs_simConnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENT_ID.PAUSE_ON, 1, priority.groupPriority, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)
            Await Task.Delay(500)
            msfs_simConnect.SetDataOnSimObject(DEFINITIONS.StructAircraftPosition, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, position)
        Catch ex As Exception
            writeLog(ex.ToString)
        End Try
    End If

End Function

Hi,

Thanks for the input. I gave your code a try and it still freezes but a little less. Not sure why. As an example, I can jump around and every 4th place the sim will freeze. Sometimes on the first try.

Is there a reason you do not use the built-in SIMCONNECT_DATA_INITPOSITION struct vs creating a custom one? I wonder if there are any differences.

If you never get the freeze, then maybe it is how your project is setup. As mentioned, if you use the SetData SimConnect example provided with the SDK, it freezes every time. If you jump too many times, the entire sim locks up to the point you have to use task manager to close it.

In MSFS 2020 I never got the freeze, but it is constant in MSFS 2024.

I use the SIMCONNECT_DATA_INIT_POSITION when I create the “new” Simconnect objects (e.g. in the app above the “probe” that I later request the altitude from)
Or the cableCars in my new AnimateLifts app,
But when I move them I give a specific structure as above
No specific reasons, but I guess the Init suggested me that the purpose was only for first Initialization of the Simobjects :slightly_smiling_face:

Maybe is the active pause that helps

As per latest help from @max.paperno ,
Using the PAUSE_SET rather than the PAUSE_ON reduce stutters in my case

I believe it depends on the location. I can sometimes move to 3 locations, but then go to one, and you get the simulator freeze and usually have to close out as you cannot get any menus back.

If you start MSFS 2024 and are at a specific airport (for example KTUS) go to the SDK\Samples\VisualStudio\SimConnectSamples\SetData\SetData.sln project, and run it exactly as it is. The sim will freeze. If you restart the SetData project with a different lat/lon, it will not work. Something is frozen in the simulator.

If you take the exact same scenario as above, in MSFS 2020, there is no issue.

It appears Asobo has updated this to bug_logged so hopefully it is something they can address. I can then update my application for MSFS 2024 compatibility.

Edit: If you start at KSEA, the SetData project will not freeze. Set it at KTUS, it will freeze.