[patch - MapTool] FoW mods + path computation fix

Notes on testing the latest builds of MapTool

Moderators: dorpond, trevor, Azhrei

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

[patch - MapTool] FoW mods + path computation fix

Post by Lee »

Hi all,

Sorry for the delay but, as promised, attached are 2 uploads: the patch for the tentative FoW speed-up, and a link to an MT build off b89 to test it. I have a couple of disclaimers, however. The b89 version is not completely patched to the latest applications to the repo, so don't look for stuff that Azhrei put in after he released the first iteration of b89. Secondly, the FoW patch is still a work in progress, and takes a couple of steps away from how it was originally handled; steps that might not see it get committed to 1.3 Final. It also is currently not an enforced setting, but is treated as a client to client preference. This preference is found, as requested, under the Map menu where Fog-of-War itself is toggled.

Anyway, let me know how it goes or if I missed anything.

Edited: As per wolph's feedback, uploaded an updated patch with fixes.
Edit #2: Patch updated. Changes include:
  • An accelerator for waypoint fog exposure (ctrl+shift+w)
  • Creation of 2 macro toggle functions (toggleFoW and exposeFogAtWaypoints)
  • Several minor behavioral improvements
Edit #3: 06/05/2013 Patch updated. Changes include:
  • Fixed lock-up caused by worker threads waiting indefinitely.
  • Capped thread pool at 15 threads.
  • Added fog exposure at waypoints for unsnapped movement.
Edit #4: Taking the patch out as it didn't apply cleanly to b90 (i.e. missing code)
Last edited by Lee on Tue Jun 11, 2013 8:25 pm, edited 10 times in total.


User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool] FoW speed-up

Post by JamzTheMan »

Thanks Lee! Something more to play with! (Man, the list is piling up)
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: [patch - MapTool] FoW speed-up

Post by jfrazierjr »

Thanks Lee... I probably won't get a chance to test this, but based on some recent discussions by various people, have you considered trying to refactor the existing code to use a path iterator to merge area's into one(or as few as possible in any event) area object? I would guess that is a large part of the entire issue is letting the java Area object do the adding/subtracting the is causing most of the slow downs. I have no idea how much(if any) it would help performance, but was wondering if you have done any playing with the existing code to see what effect it might have....
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - MapTool] FoW speed-up

Post by Lee »

Np guys :)

@jfj While I am by no means sure I tried everything, I believe this current solution does as much of what you propose as possible; which was to take individual area snapshots by making clones of the token and putting them on each step; after which results are added to the main area object. This helps skip a step or 2 in the original method where the token is moved 1 cell at a time, and visible area and the area meta data are queried/updated each time.

The problem is, as I've mentioned before, the code for computing the visible area makes a lot of sense, to the point that I believe that it is not wise to modify. I agreed to the view before that the only hangup was the performance of the stock geometry library, where Azhrei pointed out that it's likely that it doesn't route computations to the hardware side to speed up the process. I guess we'll just have to wait for results from testers before going back to the drawing board. Hopefully, things might be on an acceptable level with this current solution.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool] FoW speed-up

Post by wolph42 »

took me a while to figure out how to get it working, but that was because fow was turned off :roll:

anyhoo: the speed up is significant, about twice as fast (and a lot faster over longer distances 0.5s vs 10 seconds to move 300 squares through FoW)

encountered 'bug' / 'unwanted feature' :

- if you hit ctrl+shift+o (only currently visible) is exposes ALL last waypoints instead of the current position only. This was tested with gm server and pc token.
- if you hit ctrl+W twice (e.g. to check something without FoW and then turn it back on again) then the 'expose on waypoints only' is turned off again. I would prefer it when it would remember its last setting.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - MapTool] FoW speed-up

Post by Lee »

The first item was easy to fix. The second item, however, is something open for debate. Currently, it's a flag that's reliant on FoW and toggles itself off when FoW is disabled. To do otherwise would result in waypoint computation even when FoW is turned off because of the way the code is written right now.

Since the intended FoW design is the default behavior (non-waypoint revealing), it is only logical that this would be the default setting when FoW is enabled each time. Putting a variable in to remember the previous setting is trivial, but I'd like to hear from the official devs if this is seen as code clutter or not. As an alternative, perhaps an accelerator akin to ctrl+shift+o will suffice?

I'll await feedback from Azhrei / JFJ.

Thanks for testing :)

Edit: uploaded patch fixing the 1st item and put in the new link to the test build demoing it. 2nd item is put on hold until requested input is received.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool] FoW speed-up

Post by JamzTheMan »

OK, downloaded and tested latest patch, a welcomed addition!

I loaded up one of my "Problem" maps which had a cave about 2000 ft x 5000 ft large (grid size 50px, 5ft/grid). As a GM, sometimes I needed to move them a 1000ft to speed things up and that takes about 18 seconds , turning the "At waypoints only" option drops it down to 2 seconds. It's not really an improvement on speed as it's just skipping rendering, it's a very nice option none the less.

I would also agree that having the check mark "remembered" would be nice, and the value ignored when "disabled". It should be the default for a new map but a new user may not understand why/when it keeps getting disabled/unchecked.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [patch - MapTool] FoW speed-up

Post by Azhrei »

Lee wrote:Since the intended FoW design is the default behavior (non-waypoint revealing), it is only logical that this would be the default setting when FoW is enabled each time.
This seems reasonable.

I'll await feedback from Azhrei / JFJ.[/quote]
Crud. I hate it when people are waiting on me...

;)
Putting a variable in to remember the previous setting is trivial, but I'd like to hear from the official devs if this is seen as code clutter or not. As an alternative, perhaps an accelerator akin to ctrl+shift+o will suffice?
Hm. I see three ways to handle it:

1. Leave it as it is. (Wolph doesn't like this one. :))

2. Remember the previous state and restore it. I can't speak about whether that would be "code clutter" or not because I don't know what would be involved.

3. Keep a setting that is the default when FoW is turned on. Then if FoW is turned off and back on, the new value is copied from the default. I like this one best as it's the most flexible but it's also the most intrusive since there will need to be a new checkbox added to the Preferences dialog.

4. Provide an alternate keystroke that turns the feature on when turning on FoW. This is a good option since the code is clean and it won't interfere with the way people are currently using the program. However, it should be an easy-to-use keystroke that doesn't collide too much with other ones. If there's a good candidate for such a keystroke, then I think this is a good solution.

So I'm leaning towards #4 if there's a good keystroke to use, then towards #2 as a fallback. Opinions?

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool] FoW speed-up

Post by JamzTheMan »

I like #2 with #4 as a fallback but can live with either. :)
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool] FoW speed-up

Post by wolph42 »

JamzTheMan wrote:I like #2 with #4 as a fallback but can live with either. :)
+1 and with a clear preference for #2. If it has to be #4, maybe ctrl+shift+w or meta+shift+w, but im not very familiar with mac keyboards. I checked the wiki and it does not exist and its close to ctrl+w/meta+w for the FoW toggle

there's is a 5th alternative... have one short cut key again e.g. meta+shift+W that toggles BOTH fog and waypoint on/of.
This way you have
meta+w FoW on/off and Waypoint always off
meta+shift+w FoW and Waypoint on/off

That would be on equal par with #2 for me.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - MapTool] FoW speed-up

Post by Lee »

Went with #4. It really isn't pretty doing #2 under the hood, but that's just me. Hotkey for waypoint exposure is set at ctrl+shift+w. As a compromise, I made a couple of macro functions toggleFoW and exposeFogAtWaypoints that does the toggling of FoW and wapoint exposure, respectively; so people looking for a one key solution to do ctrl+w and ctrl+shift+w can do these 2 macros under a macro button instead.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool] FoW speed-up

Post by wolph42 »

Lee wrote:Went with #4. It really isn't pretty doing #2 under the hood, but that's just me. Hotkey for waypoint exposure is set at ctrl+shift+w. As a compromise, I made a couple of macro functions toggleFoW and exposeFogAtWaypoints that does the toggling of FoW and wapoint exposure, respectively; so people looking for a one key solution to do ctrl+w and ctrl+shift+w can do these 2 macros under a macro button instead.
cool! thanks. Few questions:
- How do the functions work? e.g. exposeFogAtWayPoint(1) turns it on and (0) off? of does it auto toggle when you call it?
- shouldn't it be toggleFogAtWaypoints ?
- what happens when you toggle eFaWP() when FoW is turned off?

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - MapTool] FoW speed-up

Post by Lee »

Have to run through really quick before hitting the road again:
-It's "auto toggle" with chat feedback as to what setting it's on.
-while it could be toggleFAWP, it's a also a new feature and people will likely understand what it does using the "expose" verb rather than "toggle"
-It just says FoW is disabled and does nothing.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool] FoW speed-up

Post by JamzTheMan »

Hi Lee, I think I found a small bug. It doesn't seem to be revealing at way points if the token is not SnappedToGrid.

Granted, without the Reveal At Waypoints toggle on, it only reveals FoW at the end point and not inbetween points with or without waypoints. However, if you toggle Reveal At Waypoints on, it does not even reveal FoW at the end point unless you have at least 1 waypoint added (and then only at the endpoint).

As a bonus enhancement, could you enable reveal at waypoints for tokens not snapped to grid now that you have this code in?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

Post Reply

Return to “Testing”