[BUG] Fog of War Issues

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

[BUG] Fog of War Issues

Post by Jagged »

I have been investigating some reported issues with Fog of War (FoW). See threads (Dynamic Lighting). I suspect that the reason I haven't encountered any issues (apart from the Ctrl-Shift-O problem) is that I do not use the "Individual view" options. The main problems seems to be:
  • Ctrl-Shift-O fails to reset FOW whether you are using shared or individual views.
  • The Fog tool appears to have no effect on areas exposed by players using individual views.
If I have missed any, please shout.

FOW is not an area of the code I know, but looking at changes added towards the end of 1.3, I see the Zone function "clearExposedArea()" was expanded with an overloaded version that takes a list of token Ids. This function was added after the ability to have individual views and individual fog, so I presume it was added to address a particular issue. I suspect that this function should also clear global fog when you have Individual Views but NOT individual fog. However that does not address that issue that the Fog Tool has no effect on Fog created by individual views.

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

Correct, it originally was intended to fix, what I thought, was an oversight.

You have the macro function Wiki: exposePCOnlyArea() where it first clears then exposes FoW for PC's. (and calls the same internal function as meta-shift-o and some of the right-click menu functions).

To restore functionality to pre-1.4 and fix the bug, simply rolling back that patch should do it. (I though I had mention that in one for the thread already for Craig). I haven't submitted it yet as I've gone off the rails again and just haven't had time to build another clean environment from Git. I was hoping the reformat would happen so I could do a dif because currently I have hundreds of "changes" showing in my dif because I had to do a reformat to pull code from another build).


ANYhoo, for my own personal reasons (as it bugs the feces out of me on how I use it), I didn't want FoW to clear for NPC's just to reset the FoW for PC's. And it's kind of a can of worms dealing with the Global vs local FoW. And as you figured it out, it's also tied into server functionality and the individual views option.

To complicate matters, I use NPC tokens for cohorts or other non-pc characters that I let the PC's control. (sure I could make them PC's, but I have so many macros that rely on pc vs npc like XP that it breaks to many things, plus I like the Green Border to remind everyone it's truly an NPC). An in my Opinion, MapTool is set to allow this functionality via Ownership. Ok, so what's the issue? Well, if NPC tokens don't clear FoW on movement, then PC's cant move them without the GM clearing FoW (if you don't allow tokens to move into VBL/Darkness).

This as led me to MY thinking at least (feel free to chime in), but FoW/Light/Sight logic would better be served breaking FoW into "Ownership" view vs PC/NPC. Right now, if you select no tokens, you get to view what all PC's see. I would think this would/should be "Let me see what all the tokens I OWN can see"? I mean, I "Own" it, I can move it, I should be able to see through it, right?

To that end, I believe I currently (in my build) restored the clearExposedArea() function as is, and simply created a new java function clearOwnedExposedArea() to do just that (as I ran into issues with global FoW with the other and other places that overlap functionality). And then added a matching Macro that calls that function, so, onMove I can clear OwnedTokens FoW only and let PC's move NPC tokens more naturally. I had to create new server/client calls to sync everything and have been testing it, I THINK it's working and I didn't break anything else (testing with/without server with/without ind view setttings, testing functions/clear FOW menu settings, etc is very time consuming. So many permutations).

The last Bug I DID run into though, and it seems to go back to at least 1.89 (and probably earlier), it seems that if you are running a server, with individual views, and some FoW exposed. (take a few tokens, move them around exposing FoW), then reset FoW (meta-shift-o), then disconnect PC player client, reconnect, Player sees old/exposed FOW until token moves and FoW changes. It's seems like if Individual views is checked, the server uses the List of GUIDs for the views, but also maintains the Global FoW. And upon connection, initially shares the Global vs Individual views at first? Not sure, that's where I left off couple weeks ago and it needs more testing.


TL;DR
1. Correct, rolling back changes to clearExposedArea() should restore FoW functionality to 1.91
2. I think clearExposedArea() is inherently overzealous in clearing FoW on NPC tokens and only should clear PC tokens.
3. I believe FoW should be tied to Ownership vs NPC/PC instead as it's more granular.
4. Working on new Functions vs changing old functions and testing. This allows MT to work as before but possibly allow more FoW options if wanted.
5. Please feel free to put a GitHub fix and ask question if needed. I don't get a lot of code time lately because of RL but I've spent a lot of time in the FoW/Light/VBL code as that's the #1 reason I use MT vs Roll20/Mote/Other tools.
-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
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

JamzTheMan wrote: I've gone off the rails again
That made me laugh.
JamzTheMan wrote:5. Please feel free to put a GitHub fix and ask question if needed. I don't get a lot of code time lately because of RL but I've spent a lot of time in the FoW/Light/VBL code as that's the #1 reason I use MT vs Roll20/Mote/Other tools.
Will do. FOW and Vision is something I need to learn more about. When I was following the code in the debugger, I was surprised at the ever-expanding data held in the zone object and I haven't quite worked out how the visible area is calculated using "Global" and "Personal" vision.

This area definitely needs documentation. Perhaps thats something we can do in the Git Wiki*


* Sounds like a character from the Transformers movies

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

Ya, at a high level its simple java Area's being combined/intersected and stored. But it quickly gets buried and divided into so many classes its hard to track.

I have POC code that can determine LOS via ray tracing instead of the area math done today, but I sort of git stuck implementing it further. I cant decide if I wanted to shoehorn it into the existing fow framework or completely rehaul it, which is a daunting task...
-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
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

I've been testing with an old 1.3 build. Not exactly sure what version, but the last modified date is 2011-04-15.

Running with 1.3
Running with Individual Views but not Individual Fog. If you Expose > Only Currently Visible (Ctrl-Shift-O) all the fog is reset. If you use the FOG Tool, it has little effect. You can hide and reveal areas of the map that no players have yet seen. You can also hide those parts of a map that were revealed by another token. So you cannot reset FOG in an area a token has seen by itself. But you can reset the areas a token can see by merit of being cleared by other PCs or are part of global Fog!

Running with 1.4.0.0
Running with Individual Views but not Individual Fog. If you Expose > Only Currently Visible (Ctrl-Shift-O), nothing happens. The token tool behaves as per above.

1.4 Branch
So I have created a Branch with the snappy name "Backout_clearExposedArea(tokenSet)" where I have backed out the function clearExposedArea(tokenSet). Which restores the behaviour to match 1.3, but I suspect the combination of individual views with shared fog, has never quite worked with the Fog Tool.

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

yea, i have not had much success with the fog tool.

Be sure to connect a second client as pc and test as well. simulating clients connecting/disconnecting showed funky results as well. Although probably the same in 1.3. I think thats what caused the bug (me not testing all scenarios). But should be good since you are just rolling back my change.

Its like the individual views should combine and update the global view but doesn't? I suppose it gets more confusing if you switch between individual views and global between campaign saves as well.

Should have craig build a bug release after this too...
-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
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

Okay, so I am confused. I've been playing with different options and I can't detect any difference in behaviour.

I have been trying "No individual views", "Individual views shared FOW" and "Individual views and individual FOW" and they all behave the same.

The only difference is that when you have "Individual views and individual FOW", using the FOG Tool gives you the ability to select individual tokens and if you want to hide an area a token has exposed due to movement, you can, if you hide it once with the token selected and once with no tokens selected (so you clear the individual view area and the global view area).

With any of the other options, you cannot hide areas that have been exposed by player movement.

All by 1.3 builds behave the same as 1.4.

:(

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

Hrm. So with "No individual views" and running a server, the FoW tool doesn't do anything? It doesn't interact with the Global FoW?

We almost need a Unit Test Script to list out all the use cases to test with FoW...


*btw, I don't think I really ever clicked on tokens specifically when using the Fog tool with individual views, could have been my issue early when using it, although I rarely ever used it, usually when I've encountered other issues with FoW.

Note: I've also seen "funkiness" (technical term) when light sources were on the hidden layer (or hidden from player). It could be "working as designed" although I was trying to create "ambient light" so wanted to hide the "sun" token I had but still show the light. I was getting all sorts of strangeness with FoW that day...
-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
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

JamzTheMan wrote:Hrm. So with "No individual views" and running a server, the FoW tool doesn't do anything? It doesn't interact with the Global FoW?
It does work on global FOW, but anything that has been revealed by that players movement is unaffected. Same behaviour in all option combinations.

My guess, is that Maptool is storing individual player view data whatever option is being run. Possibly when it makes the "MapTool.serverCommand().exposeFoW()" call to other clients? Not sure. And then it always uses the personal exposed area, again, whatever option is being run.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

Jagged wrote:My guess, is that Maptool is storing individual player view data whatever option is being run. Possibly when it makes the "MapTool.serverCommand().exposeFoW()" call to other clients? Not sure. And then it always uses the personal exposed area, again, whatever option is being run.
I had the chance to do some more debugging last night and the code base in this area seems quite confusing.

The Zone object stores a Global Exposed Area (GEA) and a list of Token Exposed Areas (TEA). When you look at the basic expose fog code, you get the impression that TEA should only be used by a server running individual Fog. However TEA is stored in every case and if TEA is not present, a token will not be able to move.

User avatar
Rulyon
Kobold
Posts: 13
Joined: Wed Sep 30, 2015 3:37 am

Re: [BUG] Fog of War Issues

Post by Rulyon »

I'm glad to see this was a known issue. I thought I was just having difficulty figuring out how to work the feature... now I know it's not quite in tip-top shape yet. I feel MUCH less frustrated (and stupid) now!

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

OK, Now FoW has officially pissed me off. It's making me do documentation, and like most developers, I detest documenting. Ug.

So...if anyone feels inclined, they can download my spreadsheet and do all the same tests, I've only done one test case so far. Need 2 more (changing the Server Options) and then again for 1.3b91, then again in my testbed... So that's about 3 tests per version, 9 test cases, dozens of tests per case.

Or if you are great at nitpicking, feel free to take a look and see if I missed anything. I did it using 3 Clients, and a variety of token ownership and type.

I'm not as concerned with what the results SHOULD be, just what they are.

https://onedrive.live.com/redir?page=vi ... Ryav4XdMtM
-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
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [BUG] Fog of War Issues

Post by Jagged »

*sees a one drive link*

*shakes head in shame*

Glad you are doing this, I was going through the same thing with my recent testing and was going to suggest we do this either here or in Craig's slack. Here is probably better.

I will try and run through these tests tonight.

cheers

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

Re: [BUG] Fog of War Issues

Post by JamzTheMan »

Jagged wrote:*sees a one drive link*
*shakes head in shame*
ya ya ya I know lol

But I wanted to use Excel vs Google Sheets in case I wanted to paste in screenshots. Excel 2016 is SO much nicer. And they give me 1 TB extra storage for free for having Office so wtf. And sharing/getting the link is right in the app. And you don't need Excel really, can use the web...

Anyhoo, looks like we'll have to add some cases to it. I figured it would grow once I started testing Individual Views/FoW server options. Feel free to post any back and forth in Slack. I posted here in case AM or Wolf or others wanted to get involved. We got some strong macro editors with years of MT experience around here! :)
-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 “MapTool 1.4”