• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA SPEED_REQUESTED flag not respected

ollyau

Resource contributor
Messages
1,038
Country
us-california
I'm using SimConnect_AICreateSimulatedObject to create an AI boat, then using SimConnect_SetDataOnSimObject to send the boat a SIMCONNECT_DATA_WAYPOINT structure. I set the SPEED_REQUESTED flag on each waypoint, but the AI system doesn't seem to respect the flag. When requesting 30 knots, the speed tends to oscillate ±3 knots (usually on the minus side). I've tried requesting 10 knots, and the speed tended to oscillate ±2 knots.

Any ideas why this is happening? Mission AI seems capable of maintaining the requested speed without minor oscillations, so I don't see any reason why I can't do the same via SimConnect.

If it makes a difference, I'm using the SDK's SimConnect library (not Tim/Beatle's Beta 3).

Here's the code I use to send waypoints (based on the SDK Managed AI Waypoints sample):

Code:
        private void sendWaypoints()
        {
            if (CarrierID != 0)
            {
                SIMCONNECT_DATA_WAYPOINT[] ft = new SIMCONNECT_DATA_WAYPOINT[listView1.Items.Count];

                simconnect.AddToDataDefinition(DEFINITIONS.CarrierWaypoints, "AI WAYPOINT LIST", "number", SIMCONNECT_DATATYPE.WAYPOINT, 0.0f, SimConnect.SIMCONNECT_UNUSED);

                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    ft[i].Flags = (uint)SIMCONNECT_WAYPOINT_FLAGS.SPEED_REQUESTED;
                    ft[i].Altitude = -1.0;
                    ft[i].Latitude = Double.Parse(listView1.Items[i].SubItems[1].Text);
                    ft[i].Longitude = Double.Parse(listView1.Items[i].SubItems[2].Text);
                    ft[i].ktsSpeed = Double.Parse(listView1.Items[i].SubItems[3].Text);
                }

                // Create a polymorphic array

                Object[] objv2 = new Object[ft.Length];
                ft.CopyTo(objv2, 0);

                // Send the waypoints to the carrier
                simconnect.SetDataOnSimObject(DEFINITIONS.CarrierWaypoints, CarrierID, 0, objv2);

                displayText("Waypoint list sent...");
                setButtons(false, false, false, true, true);
            }
            else
                displayText("Carrier ID not set!");
        }

Edit: Was doing some further testing and it seems like the carrier is yielding to the user. Could this be causing the deceleration? Either way, is there a way to disable this for SimConnect based AI?
 
Last edited:
I hate to be that person (who bumps threads), but I'm a bit impatient and looking for an answer. :p

I did a test and wrote a secondary program using Beatle's SimConnect library, in which I get the same issue. Carrier yields to user and won't maintain speed. Is there some trick or something obvious I'm missing? I set the SPEED_REQUESTED flag to no avail.

Thanks,
Orion
 
Anybody have any ideas? Either on yield to user or SPEED_REQUESTED, preferably both. :D
 
Back
Top