minetestmapper icon indicating copy to clipboard operation
minetestmapper copied to clipboard

Player names overlap causing them to be unreadable

Open InFerYes opened this issue 3 years ago • 7 comments

Is it possible to assign different colors to different players and avoid overlap?

Playing with the zoom level alleviates the problem a bit, but it's still not perfect (and results in very large images).

Left is --zoom 4, right is no zoom:

Screenshot from 2022-08-01 11-16-17

InFerYes avatar Aug 01 '22 09:08 InFerYes

I have made some changes to allow random colors for every player (colors are not persistant between renders and are randomized every time):

image

I don't know enough about git or github to turn this into a pull request. If you are interested in these changes, how could we proceed?

Also any pointers to avoid the overlap?

InFerYes avatar Aug 01 '22 10:08 InFerYes

For now I have resorted to also display the list of players in the top left corner. At first I moved them to be displayed top left exclusively with the + sign showing their position, but it's hard to discern the marks on the map that way. Not sure how I can make it better than this without actually spacing the names between themselves. Should a player actually be top left of the map, the original problem would still occur and overlap.

image

InFerYes avatar Aug 01 '22 11:08 InFerYes

I have made some changes to allow random colors for every player (colors are not persistant between renders and are randomized every time):

To make colors persistent between renders, you could generate a hash from the name string and use that as a basis for a randomly generated color. This could be as simple as keeping a list of 16 or so colors and modulating it with the hash (like IRC clients do).

It may also be a good opportunity to add an outline around player names for better readability on mixed-color backgrounds.

Calinou avatar Aug 01 '22 12:08 Calinou

It may also be a good opportunity to add an outline around player names for better readability on mixed-color backgrounds.

It's already a 7x13 pixel font so I don't know if it would look right. I can't find anything in the gd library that suggests the support of outlining or stroking the text. I just wanted to help fixing unreadable names :-)

InFerYes avatar Aug 01 '22 16:08 InFerYes

I can't find anything in the gd library that suggests the support of outlining or stroking the text.

You can draw a shadow by drawing black text with the same contents with a 1-pixel (or 2-pixel) offset on the X and Y axes :slightly_smiling_face:

Make sure to draw the shadow before the actual text, so that it appears behind the actual text.

Calinou avatar Aug 01 '22 16:08 Calinou

That does indeed look better, I tried a "drop shadow effect" first, but a full outline works better.

image

I really don't know enough about C++ to keep arrays of coordinates to check for overlap, so I'm going to need a little help to move forward with that last bit. And also the PR issue.

InFerYes avatar Aug 01 '22 20:08 InFerYes

If you could contribute an implementation of that, that'd be nice.

sfan5 avatar Aug 17 '22 07:08 sfan5