minetestmapper
minetestmapper copied to clipboard
Player names overlap causing them to be unreadable
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:

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

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?
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.

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.
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 :-)
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.
That does indeed look better, I tried a "drop shadow effect" first, but a full outline works better.

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.
If you could contribute an implementation of that, that'd be nice.