577
edits
(→Timing) |
|||
| Line 194: | Line 194: | ||
At the moment, the fgais background thread will sleep until 60 seconds have passed, only then, will it start downloading/parsing/computing new data. However, by that time, the fgms main thread is already "starving", because it has no more data to send to the fgfs client - in other words, it has to wait until the worker thread has completed. We should be preparing a new set of data earlier than that. For now, a usable workaround would be to compute even more data and use a FIFO | At the moment, the fgais background thread will sleep until 60 seconds have passed, only then, will it start downloading/parsing/computing new data. However, by that time, the fgms main thread is already "starving", because it has no more data to send to the fgfs client - in other words, it has to wait until the worker thread has completed. We should be preparing a new set of data earlier than that. For now, a usable workaround would be to compute even more data and use a FIFO | ||
it's because we have sent all our positions in stock (1...59) then the download() lock all. The problem is that the new download() come after 60 seconds but he take 6~10 seconds, the result is : | <strike>it's because we have sent all our positions in stock (1...59) then the download() lock all. The problem is that the new download() come after 60 seconds but he take 6~10 seconds, the result is : | ||
* 0s : first download (took 8s) | * 0s : first download (took 8s) | ||
* 8s : parse and recompute (took 0.5s) | * 8s : parse and recompute (took 0.5s) | ||
| Line 207: | Line 207: | ||
My solution allow an auto regulation speed of the loop. For example if I have an ultra high speee connection the download() will take 2 secondes, but if I have an ultra low speed connection it could take 9~10 seconds. | My solution allow an auto regulation speed of the loop. For example if I have an ultra high speee connection the download() will take 2 secondes, but if I have an ultra low speed connection it could take 9~10 seconds. | ||
Instead of use an hard coded variable the script can adapt totally to the connection speed. | Instead of use an hard coded variable the script can adapt totally to the connection speed.</strike> {{Done}} | ||
* we should *never* iterate through the whole AI list in the main thread *never* | * we should *never* iterate through the whole AI list in the main thread *never* {{Done}} | ||
* we definitely should not be doing that for each client (we do that now!) | * we definitely should not be doing that for each client (we do that now!) | ||
* we should only maintain a vector/map of local clients (players!) | * we should only maintain a vector/map of local clients (players!) {{Done}} | ||
* sendAITraffic should then look at this list (which is only updated by the main thread, lock held) | * sendAITraffic should then look at this list (which is only updated by the main thread, lock held) {{Done}} | ||
* Using the positions of each local client, we should then traverse the ai_list once in the background thread | * Using the positions of each local client, we should then traverse the ai_list once in the background thread | ||
* i.e. in recompute() - and check if any of the ai aircraft is in range of a local player | * i.e. in recompute() - and check if any of the ai aircraft is in range of a local player | ||
| Line 220: | Line 220: | ||
* this could be in FG_Player | * this could be in FG_Player | ||
* when the background thread is idle, it can update other aircraft | * when the background thread is idle, it can update other aircraft | ||
* it should prioritize | * it should prioritize aircraft that are going to be in range soon | ||
* and then the remaining aircraft | * and then the remaining aircraft | ||
| Line 239: | Line 239: | ||
In order to see a smooth movement of our AI traffic we need to calculate a fictive velocity, this should be done in recompute_aircraft() | In order to see a smooth movement of our AI traffic we need to calculate a fictive velocity, this should be done in recompute_aircraft() {{Done}} | ||
Currently our extrapolation routine doesn't apply climb rate, we need to implement this. | Currently our extrapolation routine doesn't apply climb rate, we need to implement this.{{Done}} | ||
== Planned Features == | == Planned Features == | ||
edits