Jump to content
The simFlight Network Forums

question on ai traffic


rana

Recommended Posts

Hi again Pete,

this is Rana - we have spoken couple of times before for Freeware access with FSUIPC for my freeware "FlightSim Manager" and "FSMMovingMap".. the map was released couple of days ago, and its working quite well.

For a new feature, I am looking into AI traffic sections, and would like to run some points through you just to ensure I have understood it right.

Bearing in mind that I don't want to use jackhammer/brute-force method to get the ai traffic, but use the flags available.

1. When there are several aircrafts flying in formation (ie. each aircraft position is changed constantly), I understand fsuipc will update slotChanges [E008 or F008] array byte to indicate the change. I haven't looked at this data yet, but assuming it would increase from 0 to FF, and then reset back to 0. Is that correct?

2. I have heard stories where AI aircraft might disappear during landing if afcad is wrong. If that is true, what happens to that slot - I guess fsuipc will set id to empty.

Looking again at the SDK, it appears that "number of slots used so far (keeps increasing, never decreases)" I need to read this value, and this is the maximum number of slots to read starting from 0. But doesn't this also imply taht, if all 96 slots were filled at any one point, but currently there is only one ai aircraft, this number would still give 96?

Sorry to bother you like this - but I would like to find the most optimized way to read this data. I will implement local caching when the flags are same - any ideas to speed up the process will be extremly helpful.

Link to comment
Share on other sites

1. When there are several aircrafts flying in formation (ie. each aircraft position is changed constantly), I understand fsuipc will update slotChanges [E008 or F008] array byte to indicate the change. I haven't looked at this data yet, but assuming it would increase from 0 to FF, and then reset back to 0. Is that correct?

Yes, it just increments it.

2. I have heard stories where AI aircraft might disappear during landing if afcad is wrong. If that is true, what happens to that slot - I guess fsuipc will set id to empty.

Of course, if an aircraft disappears, FSUIPC will empty its slot and re-use it. Otherwise it will soon run out!

There should be at least once cycel with the slot free, but don't rely on that. Use the id to check identities.

Note that the aircraft doesn't have to "disappear" to have its slot freed or re-used -- on landing it will move from the airborne to the on-ground table and vice versa on takeoff. And aircraft are "disappeared" when they go out of the range set.

Looking again at the SDK, it appears that "number of slots used so far (keeps increasing, never decreases)" I need to read this value, and this is the maximum number of slots to read starting from 0. But doesn't this also imply taht, if all 96 slots were filled at any one point, but currently there is only one ai aircraft, this number would still give 96?

Yes, of course. It is only a device to allow programs to only scan the part of the table used so far.

Regards,

Pete

Link to comment
Share on other sites

Thanks Pete for your quick reply... just making sure I understood it right..

one quick question: is there any programmable way to update "TrafficScanPerFrame" - on the SDK you mentioned:

The default scan is 10% of all AI aircraft (whether ground or airborne) on each FS frame, but this can be adjusted using the TrafficScanPerFrame parameter in the FSUIPC.INI file. If you are providing a real-time airport movement display like that provided by TrafficBoard you may want your users to increase this to 100%.....

I am hoping there would be an offset or a call to FSUIPC to read the current value, and an option to change it. I guess I can update the ini file, I am hoping for a runtime situation - so a program can change this value at runtime, and FSUIPC would reset back to default value at next restart.

just a thought. I will check the SDK to see if this already exists.

Link to comment
Share on other sites

one quick question: is there any programmable way to update "TrafficScanPerFrame" - on the SDK you mentioned:

No, because it is really a user configuration choice based on performance and traffic density. If your program is measuring the potential power of the PC and the expected traffic then I suppose you'd know how to adjust it, but this seems unlikely. What specific use do you have for such access?

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

I am begining to suspect I didn't understand the TrafficScanPerFrame factor properly.

"The default scan is 10% of all AI aircraft (whether ground or airborne)" - I am interpreting this line as, if I have 100 AI Aircraft within X distance from my aircraft (where X is "aircraft within a certain range of the user aircraft are included"), FSUIPC would report/display data for only 10. My apologies if I understood it wrong.

On the movingMap, I want to give the user option to see all AI traffics.. so apart from the user aircraft icon, there can be 96 X 2 = 192 AI aircraft icons on the map, all following its own path. If there is a demand, I can then expand it to a TCAS system. With a feature to control the scanning means, I can set it to full when the Map is loaded (and user has specified it), and reset it when its closed. Thus there is no overhead when the map is not running.

Link to comment
Share on other sites

I am begining to suspect I didn't understand the TrafficScanPerFrame factor properly.

"The default scan is 10% of all AI aircraft (whether ground or airborne)" - I am interpreting this line as, if I have 100 AI Aircraft within X distance from my aircraft (where X is "aircraft within a certain range of the user aircraft are included"), FSUIPC would report/display data for only 10. My apologies if I understood it wrong.

You do have it wrong. You are not thinking about the "per frame" part of the name.

If this is set to 100, then FSUIPC attempts to get and update the positions of ALL aircraft on EVERY single FS frame (i.e. 20-60 times a second, whatever). And this IS ALL aircraft, so if there are 300 aircraft it would make at least that many calls into parts of FS to get just the positional data. Then it selects the nearest 96 and in-range airborne and 96 nearest and in-range ground aircraft, and then gets all the other bits of data with many further calls per aircraft.

If it is set at 10, the default, it spreads all this work over 10 FS frames instead. In other words it only looks at 10% of the aircraft on each frame.

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

thanks a lot... that makes sense now. Perhaps I would be reading the traffic once a second, so with an average 20FPS, with 10% settings FSUIPC would have read the data twice :) oh well that sorts it.

thanks again.

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.