Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player names overlap causing them to be unreadable #93

Open
InFerYes opened this issue Aug 1, 2022 · 7 comments
Open

Player names overlap causing them to be unreadable #93

InFerYes opened this issue Aug 1, 2022 · 7 comments
Labels

Comments

@InFerYes
Copy link

InFerYes commented Aug 1, 2022

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
Copy link
Author

InFerYes commented Aug 1, 2022

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
Copy link
Author

InFerYes commented Aug 1, 2022

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

@Calinou
Copy link
Member

Calinou commented Aug 1, 2022

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.

@InFerYes
Copy link
Author

InFerYes commented Aug 1, 2022

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 :-)

@Calinou
Copy link
Member

Calinou commented Aug 1, 2022

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 🙂

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

@InFerYes
Copy link
Author

InFerYes commented Aug 1, 2022

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.

@sfan5 sfan5 added the bug label Aug 17, 2022
@sfan5
Copy link
Member

sfan5 commented Aug 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants