Queue Calculations

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
Daybreak
Vacuum Dragon
Posts: 641
Joined: Mon Aug 13, 2018 10:14 pm

Queue Calculations

#1 Post by Daybreak »

I am not sure if this has ben suggested before, and not even sure it is needed.

Obviously lag for some can be an issue as a game progresses.

Does the Building queue contibute to lag?

I normally have a few queue items, normally ships, that are there as a safeguard to absorb production if it starts to outstrip the current items like ships I have as REPEAT item.

I notice as I add items at the end, a 1 second lag while they are calculated. I don't know how much lag that may contribute to each TURN if there are quite a few items.

But why calculate build time at all, if it is larger than say 50 turns, which in game terms is quite a long time.

My suggeston is if the build time for any item is larger than say 50, then queue calculation for remaining items is suspended.

If many feel that 50 is too high or too low, maybe that can be set in options at the beginning of the game.

Of course this is only needed if queue calculations makes a significant contribution to lag.

Version 4.9 - for some reason I missed 4.10 is out even though checking recently

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Queue Calculations

#2 Post by Geoff the Medio »

Daybreak wrote: Thu Jun 03, 2021 11:57 pmMy suggeston is if the build time for any item is larger than say 50, then queue calculation for remaining items is suspended.
There is a limit on turns (500) to simulate and time (0.5 s) to spend doing the simulation: https://github.com/freeorion/freeorion/ ... e.cpp#L810 although there will be additional "lag" from other parts up the update calculations, including recalculating production costs / times after the queue changes, updating the GUI widgets, and updating effects on various other aspects of the game universe in response to a change to the production queue.

These turn and time limits could be made client options, adjustable at any time, and would only affect the queue simulation in the UI, not what actually happens in the game.

If you want some info about what's taking up time, at least in the latest version (not sure about 0.4.9 or earlier), you can look in the client log freeorion.log, which will have some lines like this about the queue simulation itself:

Code: Select all

13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : ProductionQueue::Update - Queue Items -> Res Groups time:        1 ms
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : ProductionQueue::Update - Cacheing Costs            time:       35 ms
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : ProductionQueue::Update - Looping over Turns        time:      466 ms
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:269 : ProductionQueue::Update                             time:      502 ms
and about GUI updating:

Code: Select all

13:06:13.061527 {0x00002e80} [debug] client : ProductionWnd.cpp:1077 : ProductionWnd::UpdateQueue()
13:06:13.289577 {0x00002e80} [debug] timer : ScopedTimer.cpp:48 : ProductionWnd::UpdateQueue time:      227 ms
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Droplet              time:     3386 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octogmixer           time:     9628 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Hexal                time:     6286 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octomix              time:     8050 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octofull             time:     8001 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octal                time:     6301 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octogone             time:     9858 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Gamorra              time:     8763 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Cavalier             time:     8027 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Orgahalf             time:     4551 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Orgatroop            time:     6209 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Octotroop            time:     9485 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Blue Archer          time:     7049 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Blue Raider          time:     6933 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Viper                time:     5182 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Outpost Base         time:     2636 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Cryonic Colony Base  time:     3570 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Colony Base          time:     3591 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Comsat               time:     1812 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Heavy Troop Drop     time:     6927 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Troop Drop           time:     6824 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Organic Outpost Ship time:     3830 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Robotic Outpost      time:     3891 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Outpost Ship         time:     3005 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Cryonic Colony Ship  time:     3910 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Colony Ship          time:     4019 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Sensor Scout         time:     3250 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Scanner Scout        time:     3268 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Flux Scout           time:     5149 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Radar Scout          time:     3264 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Flux Heavy Troops    time:     6535 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Flux Troops          time:     6375 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Small Troop Ship     time:     3922 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Troop Ship           time:     7321 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:259 : BuildDesignatorWnd::BuildSelector::PopulateList - Escort Carrier       time:     6361 µs
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:269 : BuildDesignatorWnd::BuildSelector::PopulateList                        time:      198 ms
13:06:13.487621 {0x00002e80} [debug] timer : ScopedTimer.cpp:48 : BuildDesignatorWnd::BuildSelector::Refresh() time:      198 ms
Based on that, if you've got a lot of stuff shown in the producible items list, adjusting the filters to hide some of the producible items might speed things up a bit in your current version.

Post Reply