Page MenuHomeWildfire Games

Fix game speed multiplier sometimes being outside overlay box
ClosedPublic

Authored by Imarok on Jan 16 2021, 10:33 PM.

Details

Summary

When you start a game with speed multiplier 1 and then change it the multiplier will be displayed outside the overlay box.

The code tried to save resources by only recalculating the overlay size when the number of lines in the overlay changed. It therefore did not change the size when a line got so long that it got an automatic linebreak. As fix I just always recalculate the overlay size.

Test Plan

Speed multiplayer is always visible when it should be.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Imarok created this revision.Jan 16 2021, 10:33 PM

Build has FAILED

builderr-debug-macos.txt
fatal error: fatal errorfatal error: : fatal errorfile '/Users/wfg/Jenkins/workspace/macos-differential/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-debug/js/Result.h' has been modified since the precompiled header 'obj/simulation2_Debug/precompiled.h.gch' was built: file '/Users/wfg/Jenkins/workspace/macos-differential/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-debug/js/Result.h' has been modified since the precompiled header 'obj/simulation2_Debug/precompiled.h.gch' was builtfile '/Users/wfg/Jenkins/workspace/macos-differential/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-debug/js/Result.h' has been modified since the precompiled header 'obj/simulation2_Debug/precompiled.h.gch' was built
file '/Users/wfg/Jenkins/workspace/macos-differential/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-debug/js/Result.h' has been modified since the precompiled head

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2910/display/redirect
See console output for more information: https://jenkins.wildfiregames.com/job/macos-differential/2910/display/redirectconsole

Imarok requested review of this revision.Jan 17 2021, 1:13 AM
Langbart added a subscriber: Langbart.EditedJan 17 2021, 4:33 AM

Tested it under macOS 10.15.7 SVN revision 24653 with applied patch D3391
It works. I noticed that Alpha23b uses 1 line to display game speed multiplier and game time overlay Alpha24 uses 2 lines. (see picture below)

After I "reset" my GameOptions and activate "FPS Overlay" + "Game time overlay" + game multiplier I get FPS distributed over two lines (see Picture A).
After starting a new game the problem disappears (see Picture B.)

One could also perhaps give a callback to the speed multiplier to check whether the lines have changed? I didn't do any profiling, but it may be better.

After I "reset" my GameOptions and activate "FPS Overlay" + "Game time overlay" + game multiplier I get FPS distributed over two lines (see Picture A).

Does that FPS counter on the second line get updated?

After I "reset" my GameOptions and activate "FPS Overlay" + "Game time overlay" + game multiplier I get FPS distributed over two lines (see Picture A).

Does that FPS counter on the second line get updated?

Yes, it works.

If one removes the 4 in the OverlayCounterTypes.prototype.FPS.prototype.Caption it works, but I don't know what it does? Does it set a max number of digits? Then the width of the overlay box might need to be updated.

Freagarach requested changes to this revision.EditedJan 20 2021, 9:58 AM

Problem is that the width is incorrect, hence the multiplier (and FPS when updating the config) fall on a new line.

This revision now requires changes to proceed.Jan 20 2021, 9:58 AM
Imarok updated this revision to Diff 15588.Jan 20 2021, 11:15 PM

Fix linebreak noticed by Langbart.
Also fix weird sizing when first disabling all overlays and then repeatedly enabling → disabling the FPS overlay.
Don't use callbacks for the speed multiplier as the ingame time would also need one when the game gets longer than 59.9999 minutes. (And mabye something else also would need a callback)

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/2998/display/redirect for more details.

Image A shows rP24739 without D3391 applied. If you run rP24739 with patch D3391 applied, the result are shown in image B.

Freagarach accepted this revision.Jan 21 2021, 7:13 AM
  • Fixes the issues.
  • Don't like the performance penalty, but not seeing a proper way around (infinite callbacks also not really an option indeed).
binaries/data/mods/public/gui/common/OverlayCounterManager.js
98–99 ↗(On Diff #15588)
This revision is now accepted and ready to land.Jan 21 2021, 7:13 AM
This revision was automatically updated to reflect the committed changes.
Imarok marked an inline comment as done.
bb added a subscriber: bb.Aug 12 2021, 7:29 PM
bb added inline comments.
ps/trunk/binaries/data/mods/public/gui/common/OverlayCounterManager.js
16

Another drawback is that, if this size is not sufficient (unlikely but possible), we run into the original issue.