Strange Maptools Behavior (Described inside)

Developer discussion regarding MapTool 1.4

Moderators: Azhrei, dorpond, trevor

Forum rules
Posting now open to all registered forum users.
User avatar
aliasmask
Deity
Posts: 8580
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Strange Maptools Behavior (Described inside)

Post by aliasmask »

I use to get this on my TV/Monitor too because it wasn't at it's natural resolution. I had to adjust it to fit the screen properly using the NVidia resizing tool. I guess one thing to check is to make sure your monitor is at it's native size.

User avatar
Full Bleed
Demigod
Posts: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

aliasmask wrote:I use to get this on my TV/Monitor too because it wasn't at it's natural resolution. I had to adjust it to fit the screen properly using the NVidia resizing tool. I guess one thing to check is to make sure your monitor is at it's native size.

I'm definitely running at native sizes on my monitors so it's not that.

JamzTheMan wrote:Have you tried adjusting the theme at all? If you search the forums there are some premade larger font themes and instructions.

Tinylaf doesn't really give you anything to address this except maybe changing the font. I just tried using Arial over the Tahoma default and nothing changed.


But I bet if a dev looks at how the text is rendered in that token text-pop-up box and in the other text-tool like boxes there might be some options to address it... could start by seeing what it looks like with text anti-aliasing on or off for that rendering.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Xaelvaen
Dragon
Posts: 498
Joined: Wed Aug 31, 2011 9:49 pm
Location: Somewhere between Heaven and Hell

Re: Strange Maptools Behavior (Described inside)

Post by Xaelvaen »

A lot of things discussed that I can't really wrap my head around entirely, so I'll address what I can:

Monitor is native, because it is literally that one thing that 'dithers' as I believe it was called; never on any other program or Windows itself. I've used the text tool and not noticed any similar effects, though that could just the fact that particular feature is used to track global abilities active, and goes away fairly often.

Invisible tokens, and npc tokens never get this - it is quite literally just 'PC' tokens without the greyed-out coloration to them. It starts very normal and I've noticed no change based on zoom, but I'll play around with that to confirm. [Confirmed - font is identical at 800% as 100% when Maptools first launches.] It just seems to decay after a certain amount of time of being active on Mapptools. I really don't know if that excludes anything being discussed here, but it never used to happen on b89 (the last version I used before upgrading to 1.4) and I played that for up to 12 hours a day back then.
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

User avatar
Full Bleed
Demigod
Posts: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

Xaelvaen wrote:I've used the text tool and not noticed any similar effects

No, you're right. It's not happening with the text tool. I had some single letters on a map and thought I could see some artifacting, but when tested with full strings it's not.

That means that there is probably an easy fix for this... they just need to render the token names the same way they render the text tool text.

Invisible tokens, and npc tokens never get this - it is quite literally just 'PC' tokens

You're right again. Which, again, proves that it's probably just a simple rendering setting that will clear this up.

It starts very normal and I've noticed no change based on zoom, but I'll play around with that to confirm. [Confirmed - font is identical at 800% as 100% when Maptools first launches.] It just seems to decay after a certain amount of time of being active on Mapptools.

This is where I will diverge from your observation. This has been around a long time... I just never thought it was important enough to mention... figuring it was just the way it was and something I only saw when hovering on a token. But this is present with PC labels on start up and exacerbated with zooming for me... there is not "decay". Pic included.

The first label is at 100%, the second around 206%, the 3rd at 395%.
Attachments
PC Token Label Artifacting.
PC Token Label Artifacting.
Text Dithering.jpg (22.34 KiB) Viewed 935 times
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: Strange Maptools Behavior (Described inside)

Post by JamzTheMan »

That's really a strange one indeed. Does it ever do it on "text drawings" (the text boxes labels you can add on the map via draw tools)? Just curious, I think they both draw pretty much the same way.

And there isn't anything really special being done here. Pretty standard Swing calls. The only difference between PC & NPC is the background color.

BTW, did you try the direct3d/openGL options via the launcher?
-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: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

JamzTheMan wrote:That's really a strange one indeed. Does it ever do it on "text drawings" (the text boxes labels you can add on the map via draw tools)? Just curious, I think they both draw pretty much the same way.

I thought so too, but as noted about the Text Tool above, it does *not* have the issue.

Have you checked the actual text rendering settings for the PC token box? I bet that something is different in there (or there is a typo).

BTW, did you try the direct3d/openGL options via the launcher?

I'm using 1.4.0.2 so I don't have those options. But I seriously doubt it would matter for this.
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: Strange Maptools Behavior (Described inside)

Post by JamzTheMan »

Correct me if I'm wrong but it's only on PC vs NPC tokens, correct? There's really just the one difference and that is the background. Here's the code, you can check it for typos...

[spoiler=Render Token labels]

Code: Select all

// Token names and labels
         boolean showCurrentTokenLabel = AppState.isShowTokenNames() || token == tokenUnderMouse;
         if (showCurrentTokenLabel) {
            GUID tokId = token.getId();
            int offset = 3; // Keep it from tramping on the token border.
            ImageLabel background;
            Color foreground;

            if (token.isVisible()) {
               if (token.getType() == Token.Type.NPC) {
                  background = GraphicsUtil.BLUE_LABEL;
                  foreground = Color.WHITE;
               } else {
                  background = GraphicsUtil.GREY_LABEL;
                  foreground = Color.BLACK;
               }
            } else {
               background = GraphicsUtil.DARK_GREY_LABEL;
               foreground = Color.WHITE;
            }
            String name = token.getName();
            if (isGMView && token.getGMName() != null && !StringUtil.isEmpty(token.getGMName())) {
               name += " (" + token.getGMName() + ")";
            }
            if (!view.equals(lastView) || !labelRenderingCache.containsKey(tokId)) {
               //            if ((lastView != null && !lastView.equals(view)) || !labelRenderingCache.containsKey(tokId)) {
               boolean hasLabel = false;

               // Calculate image dimensions
               FontMetrics fm = g.getFontMetrics();
               Font f = g.getFont();
               int strWidth = SwingUtilities.computeStringWidth(fm, name);

               int width = strWidth + GraphicsUtil.BOX_PADDINGX * 2;
               int height = fm.getHeight() + GraphicsUtil.BOX_PADDINGY * 2;
               int labelHeight = height;

               // If token has a label (in addition to name).
               if (token.getLabel() != null && token.getLabel().trim().length() > 0) {
                  hasLabel = true;
                  height = height * 2; // Double the image height for two boxed strings.
                  int labelWidth = SwingUtilities.computeStringWidth(fm, token.getLabel()) + GraphicsUtil.BOX_PADDINGX * 2;
                  width = (width > labelWidth) ? width : labelWidth;
               }

               // Set up the image
               BufferedImage labelRender = new BufferedImage(width, height, Transparency.TRANSLUCENT);
               Graphics2D gLabelRender = labelRender.createGraphics();
               gLabelRender.setFont(f); // Match font used in the main graphics context.
               gLabelRender.setRenderingHints(g.getRenderingHints()); // Match rendering style.

               // Draw name and label to image
               if (hasLabel) {
                  GraphicsUtil.drawBoxedString(gLabelRender, token.getLabel(), width / 2, height - (labelHeight / 2), SwingUtilities.CENTER, background, foreground);
               }
               GraphicsUtil.drawBoxedString(gLabelRender, name, width / 2, labelHeight / 2, SwingUtilities.CENTER, background, foreground);

               // Add image to cache
               labelRenderingCache.put(tokId, labelRender);
            }
            // Create LabelRenderer using cached label.
            Rectangle r = bounds.getBounds();
            delayRendering(new LabelRenderer(name, r.x + r.width / 2, r.y + r.height + offset, SwingUtilities.CENTER, background, foreground, tokId));
         }
[/spoiler]

Now, there IS a third render, and that's if token Is Visible. So, if you would like to test that for me, it will probably narrow it down to the image, which is where I suspect it lies. It looks like the background uses a PNG and not a "Color" so you have Swing rendering text and this image into a new image and maybe that grayLabelbox just doesn't play well with the render engine?

If one was inclined, they could extract/edit the MapTool jar file (just a zip file really) and edit/replace the grayLabelBox.png below and it should pick up your changes. (vs building the whole project in eclipse). It's a little hard for me to test these myself as I don't see the ARtifacting on my system.

public static final ImageLabel GREY_LABEL = new ImageLabel("net/rptools/maptool/client/image/grayLabelbox.png", 4, 4);
public static final ImageLabel BLUE_LABEL = new ImageLabel("net/rptools/maptool/client/image/blueLabelbox.png", 4, 4);
public static final ImageLabel DARK_GREY_LABEL = new ImageLabel("net/rptools/maptool/client/image/darkGreyLabelbox.png", 4, 4);
-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: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

JamzTheMan wrote:Correct me if I'm wrong but it's only on PC vs NPC tokens, correct?

Now, there IS a third render, and that's if token Is Visible. So, if you would like to test that for me, it will probably narrow it down to the image, which is where I suspect it lies. It looks like the background uses a PNG and not a "Color" so you have Swing rendering text and this image into a new image and maybe that grayLabelbox just doesn't play well with the render engine?

Good catch... you're right--if the token isn't visible it renders correctly (white on the dark grey label).

So I went ahead and tested by swapping the dark grey background with the black text and it renders fine.

I did notice a potential typo... the image is named "grayLabelbox.png" the code uses "GraphicsUtil.GREY_LABEL". I renamed the file to "greyLabelbox.png" and it threw an error on loading... I also kept the existing image and added a copy of it called "greyLabelbox.png" and it didn't fix the problem... but there may still be some other crossed wires elsewhere...

I also opened and re-saved the grayLabelbox.png in photoshop to make sure there wasn't something non-standard about it... didn't change anything.
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: Strange Maptools Behavior (Described inside)

Post by JamzTheMan »

Thanks for checking. And no typo there, well, bad naming but code wise its ok.

Try taking the current grey box you have and in photoshop try slightly adjusting the shade up/down and resaving. Could just be a color gradient not meshing well.

If you find a shade that works, post it and I can incorporate it. (heck, ANYone can submit it as a PR via gitgub really) but no problem, I can easily do it. Just an FYI that people can contribute without coding skills on graphics and language files and such...
-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: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

JamzTheMan wrote:Thanks for checking. And no typo there, well, bad naming but code wise its ok.

Try taking the current grey box you have and in photoshop try slightly adjusting the shade up/down and resaving. Could just be a color gradient not meshing well.

Is the same graphic being used with the Text Tool?
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: Strange Maptools Behavior (Described inside)

Post by JamzTheMan »

It is actually. It's also using the same method to generate the output as well.

FYI: Initiative Panel also uses the same method to generate the output. Is the text corrupted there as well?
-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: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

JamzTheMan wrote:It is actually. It's also using the same method to generate the output as well.

FYI: Initiative Panel also uses the same method to generate the output. Is the text corrupted there as well?

No.

That means something *has* to be different with the PC token label... especially compared to the text tool label, which scales/dithers the same way and looks virtually identical otherwise (same label background and text color.)
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: Strange Maptools Behavior (Described inside)

Post by JamzTheMan »

I posted the code and I'm not seeing anything different other than the background image. Only difference is the order in which things are rendered and you have the tokens rendering over the map zone (between Init panel and tokens).
-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
Xaelvaen
Dragon
Posts: 498
Joined: Wed Aug 31, 2011 9:49 pm
Location: Somewhere between Heaven and Hell

Re: Strange Maptools Behavior (Described inside)

Post by Xaelvaen »

When it comes to coding, maptools macros are about all I even dabble in, so I'm afraid this conversation has completely lost me - but thank you guys sincerely for looking into this issue. It's obviously not a game-breaker at all, but sometimes the names do actually become hard to read. Luckily, the tokens identify easily enough so it doesn't really matter. So if there does become a fix at some point, a guideline of how I could mimic that fix would be greatly appreciated.
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

User avatar
Full Bleed
Demigod
Posts: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Strange Maptools Behavior (Described inside)

Post by Full Bleed »

JamzTheMan wrote:I posted the code and I'm not seeing anything different other than the background image. Only difference is the order in which things are rendered and you have the tokens rendering over the map zone (between Init panel and tokens).

Must be something up with the png...

I made a similar image that fixes the problem. Maybe you can swap it into the next build. I didn't rename it so it would be an easy swap.
Attachments
Fix Attachment
Fix Attachment
grayLabelbox.png (3.5 KiB) Viewed 852 times
Last edited by Full Bleed on Fri May 18, 2018 8:47 am, edited 1 time in total.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Post Reply

Return to “MapTool 1.4”