Opened 9 years ago
Last modified 5 years ago
#3078 new defect
[PATCH] Improve tooltip management in gui code
Reported by: | mimo | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | UI – In-game | Keywords: | patch |
Cc: | Patch: |
Description
Presently in the gui code, there are tons of tooltip strings which are created every turns, sometimes requiring some additionnal call to GuiInterfaceCall to gather the necessary informations and then translated, and most of the time for nothing. In the attached patch, we use the Engine GetGUIObjectUnderMouse to know which tooltip is displayed if any and creates only its string. In addition this patch caches some formation info which was retrieved every turn as soon as a unit is selected, and which never changes. And finally a small inconsistency is fixed: when asking the list of available formations, the list from the player was retrieved while it should be the list of the owner of the selected units.
I've done some tests with the patch: the cpu time from "gui sim update" is decreased by about 30% when a single unit is selected (from about 20 ms/turn to 14 ms/turn on my (slow) PC), while the gain is about 10% with 200 units selected (from about 44 to 40 ms).
Attachments (1)
Change History (7)
by , 9 years ago
Attachment: | tooltip.diff added |
---|
follow-up: 2 comment:1 by , 9 years ago
Keywords: | patch review added |
---|---|
Summary: | Improve tooltip management in gui code → [PATCH] Improve tooltip management in gui code |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Thanks for the comments (here and on irc). I've included them on my wip version, but while testing the patch, i noticed two flaws:
1) with this approach, tooltips are not created when we pause the game. An easy solution is to add a call to onSimulationUpdate without tooltip restrictions just before pausing the game. 2) tooltip refreshing is too slow when we run with a small simRate (< 0.3). I've to think a bit more to find a good solution.
comment:5 by , 9 years ago
Keywords: | review removed |
---|---|
Milestone: | Alpha 19 → Backlog |
I had no time to dedicate to this ticket lately, so I've commited the part of the patch dealing with formation (caching the info in the gui) in r16460 and put the remaining ticket in backlog for the time being.
comment:6 by , 5 years ago
Component: | UI & Simulation → In-game UI |
---|
Move tickets to In-game UI
as UI & Simulation
got some sub components.
Replying to mimo: A couple of minor notes:
GuiInterface.js
Apparently the
else
-part should containret.attack[type].elevationBonus = range.elevationBonus;
cmpObstruction
part is commented out? If it's not needed it probably should be removed entirely.