[patch - MapTool b89] Polygon Topology line fix (bug?)

Notes on testing the latest builds of MapTool

Moderators: dorpond, trevor, Azhrei

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

[patch - MapTool b89] Polygon Topology line fix (bug?)

Post by JamzTheMan »

Another VBL fix, for what I consider a bug, although a minor one. This fix is for the Topology Line Tool (VBL lines). The current tool creates triangles and single points at the end vs a but square end which causes slivers and oddities, especially when reading the "Area" back via the Path Iterator. Mainly this fix creates "better" VBL with square ends and what is drawn/shown on screen is what is actually used to render vision. The current drawing is a rounded end but is for show only and not what is actually used.

It's more evident if you zoom far in and/or expand the line to a thicker stroke which I've done to better show what I found. The darker blue is unexposed FoW showing where the vision is actually calculated from.
Original tool with increased thickness for emphasis
vbl_original.PNG
vbl_original.PNG (299.39 KiB) Viewed 6116 times
New code
VBL_new_1.png
VBL_new_1.png (170.73 KiB) Viewed 6116 times
New code
VBL_new_2.png
VBL_new_2.png (211.97 KiB) Viewed 6116 times
edit: Patch has BasicStroke.JOIN_MITER instead of BasicStroke.JOIN_BEVEL to be inline with other drawing tool
Attachments
Polygon Topology line fix.txt
(1.77 KiB) Downloaded 102 times
Last edited by JamzTheMan on Wed May 08, 2013 12:44 am, edited 2 times in total.
-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
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by Full Bleed »

Interesting.

Is there a performance hit with this? I suspect the old method was for optimization so that there were less "points" to calculate from when using topology lines. In the case of the V, the calculation points seem to have increased from 5 points to at least 7 when going with the squared ends. Giving up a tiny bit of accuracy for a 20-30% increase is probably worth it.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by JamzTheMan »

No major performance hit as far as I could test. For the most part, everything gets thrown together into a java Area as is and checked and by far, badly drawn VBL will have more of an impact then a few extra points, ie if you drew a line that crossed another line by 1 pixel vs butting/ending againsted (say, for an inner wall of a building), you're adding 3-4 points right there. Also, if you choose to only draw in rectangles, you would have the same net result. Unless I missed some hidden VBL trick where we were told, "Only use Poly Line when at all possible because it performs 20-30% better!".

Is that what people do now? Mostly use Polyline vs Polygon & Rectangle tools because of performance?

I'll see if I can whip up a new map with a hundred or two crosses (simulating a typical forest of trees) and see if there is a noticable impact.

FYI: This patch has little affect to the end user if not applied, but it will increase the accuracy greatly with my future getVBL patch which reads the VBL for an area and returns x,y coords to save and reapply. It's where I noticed all the "lines" which look like rectangles 1 pixel thick turned into 3 coord triagles, with the one end nearly invisible, as you can imagine a triagle that is only 1 pixel high but 100+ pixels long, it reaches <1 pixel thick quickly and doesn't render on the screen.

Edit: FYI the original "V" still has 5 points, the new V has 6 points. Although it looks like 7 because the end is square, that is rendered by the basicStroke using technically 6 points of data. In reality I'm adding a total of 1 point of data regardless of number of segments. And technically I'm removing 1 point of data as the drawable returns the last point twice for some reason so I skip it.
-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
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by Full Bleed »

JamzTheMan wrote:I'll see if I can whip up a new map with a hundred or two crosses (simulating a typical forest of trees) and see if there is a noticable impact.
This should be a good test. Please make sure you test it in a networked environment with a couple people connected to the server.

I don't know how the VBL is calculated. If intersecting cords are part of the calculation the old method looks to be 10 versus 12. If intersecting cords aren't a part of the calculation, then it would be 6 to 8. A 20 to 33 percent difference. Even if you somehow "throw away a cord" as you indicated above (and I have no idea what that means... can you do that with the original method to make it even faster?) it seems like there would be a 10 to 15 percent difference. There also might be some other intangibles that we aren't accounting for that make it better or worse.

Polylines have always been a performance killer, especially if over used. But irregular maps tend to need them and I've noticed that less knowledgeable (aware?) MT users tend to over use it.

I'm just bringing up the topic because if there is a 10 - 33 percent performance hit, I think it's worth discussing whether that's a trade off we really need for the new functionality. I consider myself a fairly advanced MT user, but most of the new VBL function discussions I've seen have caused a glaze to come over my eyes. I've been reserving fully learning about it because 1) I never knew when/if the new functions were ever going to actually go into a "feature frozen" MT and 2) much of the discussion appears to have been fairly technical and specific to certain tools. Given that, I'm not sure how that's going to affect how widely the functions are used.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by wolph42 »

i can give this a test whirl if you create a test version. just make sure that the test version is as equal as possible with b89 original to limit the chance that other factors play a roll in the VBL calculations

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

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by JamzTheMan »

I'll be doing a new jar soon but you know this will have to be drawn manually right? ie can't cheat using a drawVBL macro :)

Although, I think I want to patch my polygon macro now using the same method.
-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 - MatpTool b89] Polygon Topology line fix (bug?)

Post by wolph42 »

JamzTheMan wrote:I'll be doing a new jar soon but you know this will have to be drawn manually right? ie can't cheat using a drawVBL macro :)
if I were to use the cross vbl function I get triangle or square lines? I would guess that I could at least use the function for one test case and drawing for the other...

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

Re: [patch - MatpTool b89] Polygon Topology line fix (bug?)

Post by JamzTheMan »

wolph42 wrote:
JamzTheMan wrote:I'll be doing a new jar soon but you know this will have to be drawn manually right? ie can't cheat using a drawVBL macro :)
if I were to use the cross vbl function I get triangle or square lines? I would guess that I could at least use the function for one test case and drawing for the other...
Square for drawVBL macros. I really meant for the "original" polylines would have to be drawn manually. Using macros for the second set would produce the same results so ya, half the test case will be easier :)
-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”