[patch - MT1.3b90] Conical light fix and enhancement

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 - MT1.3b90] Conical light fix and enhancement

Post by Lee »

Edited for relevance to b90:

Initially reported here and brought up again on this thread, the bug involves footprint highlighting not following a token's final location after a user makes adjustments to the grid. This patch addresses the issue by correcting calculations based on the grid which was missing x/y offsets.

Screenshots for the bug are found on the linked posts.

The topic discussion can be found here.

Included in separate files, is the fix with an enhancement. One file (mine) obliterates the cones base only for tokens on the token and hidden layers. Jamz version does this for all unowned tokens, regardless of layer. Both are experimental approaches and is only convenient for users who do not use any targeting schemes (thanks for the point-out FullBleed) and want added environmental effect. You have been warned! :D
Attachments
[patch - MT-b90] Conical light footprint fix (official).txt
(2.57 KiB) Downloaded 125 times
[patch - MT-b90] Conical light footprint fix and enhancement (Lee).txt
(3.15 KiB) Downloaded 131 times
[patch - MT-b90] Conical light footprint fix and enhancement (Jamz).txt
(3.06 KiB) Downloaded 118 times
Last edited by Lee on Fri Jul 19, 2013 2:38 am, edited 2 times in total.



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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

Yes, but to be sure, please test.

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by JamzTheMan »

Added the patch and tested it a bit. The first thing I noticed was that although the "footprint" is no longer lit for non-owners, the cone still starts from the center. This leaves a slice of pie that a PC could still click/select/hover, seeing the portrait and what not.

So I tested a quick fix which is to either add the footprint per your original code else subtract it. This clips the cone so it doesn't start until the edge of the token completely obscuring the token from view.

Thoughts?

suggestion

Code: Select all

	public Area getArea(Token token, Zone zone) {
		double size = radius / zone.getUnitsPerCell() * zone.getGrid().getSize();
		if (shape == null) {
			shape = ShapeType.CIRCLE;
		}
		switch (shape) {
		case SQUARE:
			return new Area(new Rectangle2D.Double(-size, -size, size * 2, size * 2));

		case CONE:
			Area area = new Area(new Arc2D.Double(-size, -size, size * 2, size * 2, 360.0 - (arcAngle / 2.0), arcAngle, Arc2D.PIE));
			if (token.getFacing() != null) {
				area = area.createTransformedArea(AffineTransform.getRotateInstance(-Math.toRadians(token.getFacing())));
			}

			// Lee: returning to original method for computing footprint, but this time, figuring in grid offsets.
			Grid g = zone.getGrid();
			Area footprint = new Area(token.getFootprint(g).getBounds(g));
			footprint.transform(AffineTransform.getTranslateInstance((-footprint.getBounds().getWidth() - g.getOffsetX()) / 2.0, (-footprint.getBounds().getHeight() - g.getOffsetY()) / 2.0));
			
			// Be sure we can always at least see our feet
			// Lee: added a check to limit lighted footprints only for tokens and seen only by their owners to add enhanced atmospheric effect (thanks to JFJ)
			if ((token.getLayer() != Zone.Layer.OBJECT && token.getLayer() != Zone.Layer.BACKGROUND) && AppUtil.playerOwns(token)) {
				area.add(footprint);
			} else {
				// Remove the footprint so light starts on token edge
				area.subtract(footprint);
			}

			return area;

		default:
		case CIRCLE:
			return new Area(new Ellipse2D.Double(-size, -size, size * 2, size * 2));
		}
	}
PS Sorry, would have attached screenshots but I seem to be having PC troubles ATM. Windows Save dialogs are freezing!
-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

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

@Jamz Yeah, good of you to suggest that. I was lining that up as the next suggestion after people look into how they like conical lights for stamps (i.e. stuff not on the token/hidden layer). I'll put it in but change it a bit so that objects don't get their cones clipped. Thanks.

Edit: changes made. please test :)

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by JamzTheMan »

Tested and looks good. But. (there has to be a but, right?)

Not sure I agree with showing the footprint, ever. Including on Object & Background layer. It reaches into the "don't tell me how to use my tokens/layers" territory. :)

If it's good enough to add a footprint light source if needed for tokens, should be the same for other layers. (by that I mean adding an additional light source to light the footprint for other owners to see)

Here's my example:

I have a tower/sentry post. On said post I have a huge fixed spotlight that doesn't move, so obviously a "stamp" or object, so to the object layer it goes. Now, my PC's shouldn't see how many men are behind that spot light, correct? Even though they will most likely be in the same "square" as the spotlight.

Same goes for cars, boats, trains, etc.

Edit: PS, I also did test the grid size/offset and confirmed those are fixed. Didn't want to loose "sight" of the original issue you are fixing. :)
-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

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

JamzTheMan wrote: Not sure I agree with showing the footprint, ever. Including on Object & Background layer. It reaches into the "don't tell me how to use my tokens/layers" territory. :)

...I have a tower/sentry post. On said post I have a huge fixed spotlight that doesn't move, so obviously a "stamp" or object, so to the object layer it goes. Now, my PC's shouldn't see how many men are behind that spot light, correct? Even though they will most likely be in the same "square" as the spotlight.

Same goes for cars, boats, trains, etc.
That's a sticky topic. Playing devil's advocate, barring JFJ's practical point out that owners should be able to click on their tokens, realistically, bearers of conical light sources, depending on the relative perspective of a viewer, gives some detail away about itself, right? Also, a light-bearer can obscure itself to some degree through perspective and contrast, which justifies chopping off part of the cone, but shouldn't anyone/anything stepping into/occupying the area of illumination be then illuminated if it is tangible/visible/able to react with light?

Also, it's a matter of environmental scale and/or context. Ideally, no one would be sharing the same space as an object, unless it can phase through/around/under the object or be inside of it. If all tokens/stamps are of the same size, then, yes, you do have a point, but can't that be ameliorated by design decisions? i.e. don't put tokens in the vehicle until adequate proximity is reached, or a perception/awareness check is made etc., make a token the light bearer instead of the sentry post (control=obscurity i.e. there's someone swinging that light around vs. a static light or one that swings in an automated pattern). Again, these are just devil-advocated opinions :D

Let's keep the discussion going until something adequate is fleshed out. Hopefully, jfj and the others chime in as well.

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by JamzTheMan »

Well, your first part of the argument would go for tokens as well, no? Basically, what ever argument can be made for hiding the token behind a cone light on a token layer can be made for a object on the object layer.

And for sharing space, sure, you have a spot light mounted to a way, the guy steps up behind it. It's a 5 foot space, both can occupy the same square easily.

But yes, all good discussions. Ultimately we both can build our own rules for it, so yes, what do other people want. :)
-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

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

Yeah, you have a point about when a cell is at standard 5', but like that issue I had to fix when a user wants to go a different, smaller scale, then your context probably wouldn't fit him/her (IMO). Unless, some more intelligence is put to adjust according to scale (i.e. the further out, the lesser the footprint illumination) but I think that kind of stuff is more suited to 1.4/2.0.

There's also an option to create a light source option that "eats" areas of light; a specialized child could be one for "self"/"footprint", which I think would perform faster than, say, drawing vbl around a token's footprint.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Full Bleed »

Lee wrote:...barring JFJ's practical point out that owners should be able to click on their tokens...
Doesn't the practical application of the issue begin and end with that reality?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

Full Bleed wrote: Doesn't the practical application of the issue begin and end with that reality?
We went a little further for effect. Now, owners still have lighted footprints so they can easily click on their tokens, but for tokens they do not own, the footprint is blacked out (chopping off the the part of the conical light it intersects with). We're currently discussing what to do for tokens not on the Token and Hidden layers as it is a matter now of design perspective. Jamz wants all footprints blackened out if the token is not owned, regardless of layer, whereas I want to only do that for the Token/Hidden layer.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Full Bleed »

Lee wrote:We went a little further for effect. Now, owners still have lighted footprints so they can easily click on their tokens, but for tokens they do not own, the footprint is blacked out (chopping off the the part of the conical light it intersects with). We're currently discussing what to do for tokens not on the Token and Hidden layers as it is a matter now of design perspective. Jamz wants all footprints blackened out if the token is not owned, regardless of layer, whereas I want to only do that for the Token/Hidden layer.
I rarely use conical lighting because players just end up whirling the lighting around and looking anyway, so I don't have much of a horse in this race... but won't the method you're describing, potentially, make targeting tokens with conical lighting difficult?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by Lee »

Full Bleed wrote: I rarely use conical lighting because players just end up whirling the lighting around and looking anyway, so I don't have much of a horse in this race... but won't the method you're describing, potentially, make targeting tokens with conical lighting difficult?
Two great points there.

#1 When I first experimented with this months ago, there was still a sliver of the token's image shown (the cone's base), so all my targeting schemes worked (though other schemes may indeed suffer). The obliteration of the base is new and, while desirable, will indeed create targeting/awareness problems. Sigh.

#2 You made me remember to code in a facing lock. I've always wanted that :D

@Jamz: I guess the only workaround for what you want (no details given away) should not be done on the official code base, but the application itself. We can always put it in our own versions, however :lol: Honestly, moving forward, I think footprint lighting should be default for all, and a separate light source to obliterate portions of light areas (along with macro function controls) can then be made for scenarios we want what we discussed for.

I'll be uploading another patch for just the fix and mark that as the official one for b90.

Thanks FullBleed.

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

Re: [patch - MT1.3b90] Conical light fix and enhancement

Post by JamzTheMan »

Ya, that's a good point regarding targeting. What we need is a new "system". Something where generic icons can be shown and used for targeting and such, but not show the icon/portrait unless <insert criteria here>. read: next version of mt.

I'm ok with nixing the footprint thing as it were. Heck, If I REALLY need to emulate that, I'll just use my "Darkness" lighting and put a 5' dark source over 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

Post Reply

Return to “Testing”