• 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.

Creating AI multiple sources - how do I know mine

Messages
11
Country
us-texas
I am using P3dV4 and I have an external simConnect exe. I currently request and publish data for the user AC. I will be creating AI, but an external server that will also be injecting AI into my P3D session. I need to know which I create because I need to monitor and publish data about "my" AI. I will not monitor the externally created AI. If I use a SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE to get the object ID of all aircraft, how can I distinguish my AI from those created externally? I am in the design stage for this issue.

I have seen in the P3D AI traffic example that when the Parked Maule is created the ParkedMauleID is set to pObjData->dwObjectID. Is this the same as the objectID I would receive when I use SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE? If so, can't I use this objectID to request data? Or am I mixing apples and oranges.

I'm still in early learning mode, so any insights would be appreciated.
 
Hi,

without going into too much detail here:

if you request an AI object to be created you supply a self defined RequestID (Enum) in one of the function parameters of e.g. AICreateNonATCAircraft to SimConnect. You save this RequestID in a list, vector, dictionary, or map, depending on your programming language, to keep track of the request and how SimConnect handles it.

Then, you must have an event handler defined in your code (OnRecvAssignedObjectId) that gets called, if SimConnect was able to create the requested object. Inside this event handler, you can identify the RequestID you chose (dwRequestID) and match it with the dwObjectID which was assigned to the object by SimConnect and which is to be used in all further calls to "your" object. Your RequestID becomes obsolet at this point.

This is just a quick and dirty recap, of how things work for me...maybe it already helps you to understand the process. If it doesn't, just ask again ;).

Greets, Benny
 
Thanks Benny,
That's a great description, and much clearer than a lot of the documentation. I had understood the first part, but wasn't sure I could continue to use the returned dwObjectID for the data request. I didn't have confidence I could do that since all examples and most posts say to use the SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE to get the object ID.
 
Back
Top