Jump to content
The simFlight Network Forums

Counting Ai on ground and airborne


Recommended Posts

Hi John,

I'm currently using a LUA script to count the number of Ai in P3D v4 using the offset 025C. But that only gives the total count and doesn't differentiate between ground and airborne.

I've looked though the Offsets file but can't find anything that would give me this info. I still use Traffic Look and that can show them separately. Is it possible to do the same via LUA?

Link to comment
Share on other sites

Hi Ray,

it doesn't look like this information is easily accessible via Lua. You may be able to differentiate between airborne/ground traffic by counting the number of non-zero entries in the ground/airborne traffic data offsets at E080 / F080, but I'm not 100% sure. I'll take a look in a bit more detail later in the week (and check with Pete!).

Cheers,

John

Link to comment
Share on other sites

Hi John,

Pete has suggested I request this feature but it’s not urgent so fit it in when you’re able.

With so many Ai from the AIG package injected into P3D it would be helpful to know how many are ground based and airborne. That would help when assessing the impact of Ai on fps when pushing P3D hard for best performance.

I understand the Ai bubble is 80nm. So when I’m sitting at EGLL and the count currently says 300 that’s taking into account Ai at Gatwick, London City, Stansted and Luton plus those overhead. Oh, and Northolt too perhaps. Knowing how many ground Ai just at Heathrow would be helpful. So as well as separating ground & airborne is it possible to filter by airport?

Link to comment
Share on other sites

Ray,

 This may be a perfect project for a gauge rather than a ipc/simconnect lookup.
Using a gauge allows an easy user interface such as distance from current location, etc..
Downside of course is that the gauge needs to be installed in each of your testing aircraft.
Since it is just for performance testing, not really a bad downside.
All the variables needed are there.. (Referencing FSX, but checked the P3D SDK, all good)

P3D References -
http://www.prepar3d.com/SDKv4/sdk/references/variables/custom_variables.html

FSX References -
FSX SDK (not ESP SDK)
FSX\SimObjects\Misc\ControlTower\panel
FSX\Gauges\Radar.cab
______________________________________________________________________________

C CLASS | CLASS NAME | UNITS | SETTABLE | DESCRIPTION

ITrafficInfo | Radius | meters | Yes | The radius from the user aircraft (or tower) to use to collect data on nearby aircraft or vehicles. 
ITrafficInfo | Latitude | radians | Yes | The latitude of the point the search is to be made from. 
ITrafficInfo | Longitude | radians | Yes | The longitude of the point the search is to be made from. 
ITrafficInfo | Filter | enum | Yes | One or more of the following values combined:
    TRAFFIC_FILTER_AIRCRAFT = 1,
    TRAFFIC_FILTER_GROUND_VEHICLES = 2,
    TRAFFIC_FILTER_TOWER_CONTROLLERS = 4,
    TRAFFIC_FILTER_ON_GROUND = 8,
    TRAFFIC_FILTER_IN_AIR = 16,
    TRAFFIC_FILTER_SLEEPING = 32,
    TRAFFIC_FILTER_AWAKE = 64  
ITrafficInfo | ListSize | number | No | The length of the list of vehicles returned after a search. The index numbers of the returned list will be from 0 to ListSize - 1.

______________________________________________________________________________

If you are interested I may be able to help in creating one - a perfect morning coffee project. 😉 

Roman

Link to comment
Share on other sites

Roman,

I appreciate your kind offer but a gauge would not appeal. Running WideFS on a second computer does allow me to display info of this type in a small window which is ideal for me.

Is it possible it could be achieved via a executable instead?

Link to comment
Share on other sites

The gauge can/would output lvars for you.
From there you could do a lua to display of the values - but -
Setting the lookup radius would have to be done via the gauge - or -  a default value in the lua. 

Thinking more, just may run with it as a "fun" type project to do.. An extra "wake me up" for the morning.
Will start tomorrow morn - to darn nice outside, finally!! 😉

Roman 

EDIT - An exe just may/could be made. ( or at least experimented with ) Just checked FSUIPCClientDLL code examples and it "looks" like everything is there.
Will go the gauge route 1st to get the code flow then maybe go the exe route.. (it would take a while for the exe)

Edited by spokes2112
Checked Paul Henty's excellent FSUIPCClientDLL for AITraffic services
Link to comment
Share on other sites

Ray,

Guess I didn't have enough coffee yesterday.. Forgot to look at the lua library - flags & l:var read/write are not available on wideclient.
A gauge server to lua works great (see image) but only on the local FS computer.
I wanted to give it some user adjustability, namely the AI lookup radius & AI lookup timing. ( the latter dependant on the users sim performance - kind of important )
In order to do this and run it on wideclient it would have to be:
gauge server < --- > local sim lua < --- > fsuipc user offsets (or ipc. get/set) < --- > wideclient lua
Each of the 4 parts need to "talk" to its neighbor in the logic chain. Kind of a mess to say the least.. 
So it looks like an exe will be the route.. Not the best as a self taught hobbyist doing exe programming so it will take a while.

Another project for tomorrow's coffee 😉

 

AI_Counter.jpg

Link to comment
Share on other sites

Hi Roman,

Thanks for your news. Unfortunately the image isn’t showing. If you’re able to provide an exe that can retrieve data via WideFS I am happy to wait

I’m using a utility that shows Ai in P3D and it runs across WideFS. But it’s difficult for it to provide the data in a simple format to fit into a small space. You can find Ai Companion here. https://www.alpha-india.net/forums/index.php?topic=29651.0

Hopefully it won’t prove difficult for you and being able to filter either by distance or ICAO and show counts by the Ai status would be very useful both for me and many others I think.

Maybe less coffee and more tea - English perhaps. 😉👍

  • Haha 1
Link to comment
Share on other sites

Hi Ray,

Big problems here.. Using FSUIPC limits the count of both on ground and in air AI to 96 each.
Are you sure  Ai Companion runs over Wideclient?  Rather I am thinking it is possibly simconnect instead in order to get over the 96 each max count.
Simconnect is out of my league.. 
I could however use a server gauge in the test aircraft to get a full count "and" be able to center on an ICAO too.. Something that doesn't seem possible using the FSUIPC route. 
The program is to the point of integrating a XML gauge.. 
Your thoughts? Would using a server gauge, needed to be installed in the test aircraft be too much?

Roman

 

 

AI_Counter_at_EGLL.jpg

Link to comment
Share on other sites

Hi Roman,

Aii Companion uses a combo of WideFS and SimConnect across a network but purely SimConnect when run on the same PC as P3D. Bear in mind AiC is designed to be used with AIG Ai Traffic which is designed for P3D v4 only. I notice you're testing with FSX. Would FSUIPC5 have the same limitation? Maybe Pete or John can answer that question.

A gauge would not be something I would want to use, sorry. This was something desirable rather than essential. Thank you for your efforts.

Link to comment
Share on other sites

3 hours ago, spokes2112 said:

Big problems here.. Using FSUIPC limits the count of both on ground and in air AI to 96 each.

Yes, the tables are in limited offset space, so are of fixed allocated size. You need a SimConnect interface.

John and i will be discussing adding these values as offsets, but in FSUIPC5 only, and not immediately. It'll be listed along with other things.

Pete

 

  • Like 1
Link to comment
Share on other sites

4 hours ago, Ray Proudfoot said:

A gauge would not be something I would want to use, sorry. This was something desirable rather than essential. Thank you for your efforts.

Ray,

Yes I understand.. Wish that it could be stand a alone for the biggest airports.. It works great up to those biggest traffic areas though.
EGLL was just above the limits until the traffic started flowing, it then settled down to below the limits.
Going to keep going just for the learning experience, only a few meters away from the finish line. 😉 Why stop now?
Paul Henty's newest module has some great new features haven't seen before and this little project will use them.

Will advise when finished, even if not interested.. 
It's not a big deal - the learning experience is worth it!

Roman

Link to comment
Share on other sites

Hi Ray,

you can try this version (v5.5151b): FSUIPC5.txt

(its the dll - download & rename to FSUIPC5.dll).

I've added the total ground AI at offset 02A2, and airborne AI at offset 02A4, both 16-bit (U16).

No filter by airport I'm afraid. You can get the distance from you in the readable offsets previously mentioned, but only the first 96 each of airborne/ground.

Cheers,

John

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.