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):
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?
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:
