How to change AI aircraft's behaviour using external programs

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Post Reply
g1235813
Posts: 16
Joined: Fri May 27, 2022 2:50 am

How to change AI aircraft's behaviour using external programs

Post by g1235813 »

Hi,
I'm trying to inplement a control panel program to simulate communications in a flight formation. The scenario would be something like this: there is an AI wingman always following the player, and keeps a fixed relative position, say,1000 meters behind the player aircraft. Now I want my control panel program(on another computer) can send data via socket to change this wingman's AI, like change the relative position or change the AI from wingman to combat patrol, etc.

I'm studying simDirector and simConnect documentations, but so far I have no clue on how to begin with. For now I think the workflow might be like:
a)Create a scene using simDirector
b)Write a program to receive the data sent fromg control panel,and
c)Using simConnect,Input said data to Prepar3d to change certain parameters of the scene (wingman distance from player, AI behaviour type,...)

Is this workflow correct and recommended for my purpose? And how exactly can I implement part c)?
Any help is much appreciated. Thanks!
User avatar
JorgenSA
Posts: 6008
Joined: Sun Mar 11, 2018 7:17 am
Location: 5 NM ENE of EDXF

Re: How to change AI aircraft's behaviour using external programs

Post by JorgenSA »

The thing is, as least as far as my knowledge of AI flight plans go, that AI flight plans are in effect fixed programs that tells the AI aircraft what to do, with no regard to any user-controlled aircraft. The AI aircraft does what the programmed flight plan tells it to do, nothing else.

To change this behavior, you have to exit the simulator, re-program and re-compile the AI flight plan, and then start the simulation again. But - the above rules for AI aircraft still apply.

Now, as I said above, this is as far as my knowledge of AI flight plans go - maybe I should say traditional AI flight plans? If there are any new things possible here, or any workarounds possible, I sure would love to hear about it too!

Jorgen
System: i5-12600K@4.9 GHz, ASUS ROG STRIX Z690-I motherboard, 32 GB 4800 MHz DDR5 RAM, Gainward RTX 3060 w/ 12 GB DDR6 VRAM, Windows 10 Pro.

All views and opinions expressed here are entirely my own. I am not a Lockheed-Martin employee.
g1235813
Posts: 16
Joined: Fri May 27, 2022 2:50 am

Re: How to change AI aircraft's behaviour using external programs

Post by g1235813 »

JorgenSA wrote: Wed Mar 29, 2023 9:30 am The thing is, as least as far as my knowledge of AI flight plans go, that AI flight plans are in effect fixed programs that tells the AI aircraft what to do, with no regard to any user-controlled aircraft. The AI aircraft does what the programmed flight plan tells it to do, nothing else.

To change this behavior, you have to exit the simulator, re-program and re-compile the AI flight plan, and then start the simulation again. But - the above rules for AI aircraft still apply.

Now, as I said above, this is as far as my knowledge of AI flight plans go - maybe I should say traditional AI flight plans? If there are any new things possible here, or any workarounds possible, I sure would love to hear about it too!

Jorgen
Thanks for the reply!
I once made a scene using simDirector, where I put two AI aircraft near the player's aircraft, set their ai type to "wingman", and set some proprties such as leader, distance, direction... And the result being those two AI aircrafts stay formation with player, one always 500 meters above player, and one always 500 meters behind.
This was done in simDirector. What I want now is that my external program can change those properties, like change "wingman" to "combat patrol", change "above" to "ahead", change "500" to "1000", etc. I wander is that possible via simconnect functions?
User avatar
JorgenSA
Posts: 6008
Joined: Sun Mar 11, 2018 7:17 am
Location: 5 NM ENE of EDXF

Re: How to change AI aircraft's behaviour using external programs

Post by JorgenSA »

I think the real question here is if something like what you say can be done "on the fly"?

This is where my lack of SimDirector-knowledge is like a round 0...

Jorgen
System: i5-12600K@4.9 GHz, ASUS ROG STRIX Z690-I motherboard, 32 GB 4800 MHz DDR5 RAM, Gainward RTX 3060 w/ 12 GB DDR6 VRAM, Windows 10 Pro.

All views and opinions expressed here are entirely my own. I am not a Lockheed-Martin employee.
g1235813
Posts: 16
Joined: Fri May 27, 2022 2:50 am

Re: How to change AI aircraft's behaviour using external programs

Post by g1235813 »

JorgenSA wrote: Wed Mar 29, 2023 10:25 am I think the real question here is if something like what you say can be done "on the fly"?

This is where my lack of SimDirector-knowledge is like a round 0...

Jorgen
Yes it has to be on the fly, which is the hardest part...hope I can find a way or some workaround
Post Reply