Version: 1.5.3.0 (SimConnect 1.4.1)
Frequency: Consistently
Severity: Blocker
Context: All default any airport (example uses KSEA).
Bug description: injecting default Asobo AI objects using SimConnect_AICreateSimulatedObject exceeding a max number of times (in my experience around 45-60) causes MSFS 2024 to CTD. Same result for SimConnect_AICreateSimulatedObject_EX1, SimConnect_AICreateSimulatedObject_EX1 and SimConnect_AICreateNonATCAircraft
Repro steps: Use SimConnect_AICreateSimulatedObject to inject 100 default Asobo AI objects at any airport. The provided code sample injects at the aiport KSEA. Same result for when injecting using SimConnect_AICreateSimulatedObject_EX1, SimConnect_AICreateSimulatedObject_EX1 and SimConnect_AICreateNonATCAircraft
Attachments: (1) simple test C++ code (,cpp) that injects a user specified number of default Asobo objects using one of the four above-mentioned injection methods (user selectable) at KSEA stock. The code is also block quoted below for copy and paste.
Crash Dump File Available On Request (too large to upload: zip size 44 MB)
AICreateTest1.cpp (4.2 KB)
//***************************************
//Simconnect AICreateNonATC Test to Demonstrate that in 2024 SU3 there is a small **MAX LIMIT** of objects that can be injected using various simconnect commands, which if exceeded causes a CTD.
//***************************************
#include <windows.h>
#include <string>
#include <iostream>
#include "SimConnect.h"
static enum DATA_REQUEST_ID
{
REQUEST_CREATE_NONATC_AI,
REQUEST_CREATE_NONATC_AI_EX1,
REQUEST_CREATE_SIM_OBJECT,
REQUEST_CREATE_SIM_OBJECT_EX1
};
int main()
{
HANDLE hSimConnect = NULL;
HRESULT hr;
if (SUCCEEDED(SimConnect_Open(&hSimConnect, "AI Create Test 1", NULL, 0, 0, 0)))
{
SIMCONNECT_DATA_INITPOSITION wp_init = { 0 };
//Start Position: KSEA 34R
wp_init.Latitude = 47.431990;
wp_init.Longitude = -122.308059;
wp_init.Altitude = 0;
wp_init.Pitch = 0;
wp_init.Bank = 0;
wp_init.Heading = 6.004;
wp_init.OnGround = 1;
wp_init.Airspeed = 0;
//************************************
int max_limit = 100; //Max limit of objects to inject --> Too High --> CTD in 2024 SU3 (45 seems to work OK, around 60 causes a CTD, max value is probably somewhere in between).
//************************************
//************************************
int inject_method = 1; //Inject Method (1 = AICreateNonATCAircraft, 2 = AICreateSimulatedObject, 3 = AICreateNonATCAircraft_EX1, 4 = AICreateSimulatedObject_EX1)
//************************************
// User selects max number of injections (integer) and the injection method (integer)
std::cout << "MSFS 2024 Max AI Object Injection Limit Test." << '\n';
std::cout << "Ensure you are located at KSEA (flight FULLY loaded) using MSFS 2024 **SU3**." << '\n';
std::cout << "Enter the Max Limit of AI Objects to be Injected (Integer): ";
std::cin >> max_limit;
std::cout << '\n' << "Max Limit is: " << max_limit << '\n';
std::cout << '\n' << "Inject Method (Integer 1=NonATCAircraft,2=SimulatedObject,3=NonATCAircraft_EX1,4=SimulatedObject_EX1): ";
std::cin >> inject_method;
std::cout << '\n' << "Inject Method is: " << inject_method << '\n';
Sleep(1000);
std::cout << '\n' << "Injecting Onto KSEA Runway 34L...." << '\n';
//Inject multiple objects at simple position offsets from start position
for (int i = 0; i < max_limit; ++i)
{
//create numerically increasing tail numbers to avoid dupe tail numbers (probably not needed)
std::string tail_numeric_string = std::to_string(i);
std::string tail_number = "T" + tail_numeric_string;
const char* szTailNumber = tail_number.c_str();
//user-selected injection method
switch (inject_method)
{
case 2:
hr = SimConnect_AICreateSimulatedObject(hSimConnect, "Asobo PassiveAircraft C172", wp_init, REQUEST_CREATE_SIM_OBJECT);
break;
case 3:
hr = SimConnect_AICreateNonATCAircraft_EX1(hSimConnect, "Asobo PassiveAircraft B767-300", "B767_300_Official", szTailNumber, wp_init, REQUEST_CREATE_NONATC_AI_EX1);
break;
case 4:
hr = SimConnect_AICreateSimulatedObject_EX1(hSimConnect, "Asobo PassiveAircraft B767-300", "B767_300_Official", wp_init, REQUEST_CREATE_SIM_OBJECT_EX1);
break;
default:
hr = SimConnect_AICreateNonATCAircraft(hSimConnect, "Asobo PassiveAircraft C172", szTailNumber, wp_init, REQUEST_CREATE_NONATC_AI);
}
if (hr != S_OK)
{
std::cout << "Test Injection ERROR (MSFS 2024 CTD?), press any key to end!" << '\n';
system("pause");
return 1;
}
std::cout << "Injected AI Object, Tail No.: " << tail_number << '\n';
Sleep(500); //Not needed but may be helpful to monitor injection progress (e.g., in devmode sim objects viewer)
//calc simple lat-lon offsets for next injection iteration
wp_init.Latitude += 0.0001;
if (wp_init.Latitude > 47.463622)
{
wp_init.Latitude = 47.440823;
wp_init.Latitude -= 0.0001;
}
}
Sleep(1000);
std::cout << "Test Injections Complete, press any key to end!" << '\n';
system("pause");
hr = SimConnect_Close(hSimConnect);
return 0;
}
else
{
std::cout << "Could not connect to SimConnect, ending program." << '\n';
Sleep(5000);
return 1;
}
}