RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.
http://rptools.net
GNU Affero General Public License v3.0
802 stars 262 forks source link

[Bug]: Frame rate preference is only applied to newly loaded maps #4335

Closed kwvanderlinde closed 1 year ago

kwvanderlinde commented 1 year ago

Describe the Bug

When changing the Frame Rate Cap application preference, the new value is not applied until a new map is created or the campaign is reloaded.

To Reproduce

  1. Set the Frame Rate Cap to 60.
  2. Create a new campaign with a new map. Add a token to it so it sticks around later.
  3. Pan the map. It should be relatively smooth.
  4. Set the Frame Rate Cap to 1.
  5. Pan the map. It should still be smooth.
  6. Create a second map
  7. Pan the second map. It should be unbearably slow.
  8. Switch back to the first map.
  9. Pan the map. It should still be smooth.

Expected Behaviour

The first map should also pan unbearably slow after the cap is lowered. Whenever the cap is changed, it should apply to all maps immediately.

Screenshots

No response

MapTool Info

1.13.2

Desktop

Linux Mint 21.2 Cinnamon

Additional Context

Based on the code, this behaviour goes back to when the cap was first made configurable in 1.5.7. It also applies to the 1.14 release candidates.

At issue is that ZoneRenderer / DebounceExecutor do not offer a way to update the interval, so any existing ZoneRenderer will never use the updated value from the preferences.

Baaaaaz commented 8 months ago

N.B. Frame Rate Cap located under: Edit Menu > Preferences > Application > Performance > Frame Rate Cap

Reproduced issue in 1.13.2 and 1.14.3 Issue fixed in 1.15.0-rc.2

So a pass from me!

However, I did notice that MapTool gets frazzled if you type 0 into the Frame Rate Cap and save it.

In 1.15.0-rc.2 this raises an unexpected error straight away when typing 0 into the Frame Rate Cap field (java.lang.ArithmeticException: / by zero), but in 1.13.2 and 1.14.3 it does not. So not a new error, and if anything in 1.15.0-rc.2 it lets you know of the problem straight away which is a bonus.

Setting Frame Rate Cap to 0 probably needs a new bug ticket, but in all three versions if you set Frame Rate Cap to 0 and try to either: add a new map, restart MapTool, or load a campaign (from Windows explorer) you get a black map, the select map toolbar breaks, and/or you get various java errors thrown at you. Fix is to reset Frame Rate Cap >0 and restart MapTool.

Similarly you can set the Frame Rate Cap to negative numbers or non-numerics, but did not appear to cause the same MapTool mayhem as setting it to 0.