Page 1 of 1

enforce player chat color to be readable

Posted: Tue Feb 13, 2018 12:35 pm
by GottZ
to everyone: please leave feedback if you agree or disagree to this. commenting will bump it up in the thread overview. i'd like to know everyones opinion on this. strawpoll.me/15064935
corresponding reddit post: /r/factorio/7xht6p
simple and easy explaination of the problem:
  • low contrast between text and background
  • if you use steam in home streaming or similar, it will introduce artefacts as seen in both of my screenshots, making this even worse
    unreadable dark and bright example
    unreadable dark and bright example
    K3bwj2s.png (197.29 KiB) Viewed 12127 times
effected scenarios:
  • twitch streaming
  • youtube videos
  • colorblind / visually handicapped people
  • steam in home streaming
  • nvidia shield
  • in general everything that records your screen
  • bad / cheap screens
  • desired user experience
possible fix:
  • increase text contrast
  • maybe only color the player name and not the text. most chat clients do this for a good reason. this would improve readability even further
  • introduce a system that pins chat color to high brightness colors either through rgb pinning as suggested below or through HSL rules (wich would essentially have the same outcome)
  • in addition to that, it might be a good idea to have either a bigger contrast outline around text or just to add a solid dark background color to console text
  • maybe only allow dark colors for entities like the player sprite etc. and ditch dark colors all together from text. (thinking about the minimap etc.)
suggested pseudocode:
constraints:
r, g and b are red, green and blue and should be between or equal to 0 and 1

Code: Select all

// smallest possible number in IEEE 754.
// i don't know what you use internally. just replace it with the fitting constant.
const double epsilon = 2.220446049250313e-16;
// figure out the peak value across all color channels.
double m = max(r, g, b);
// prevents division by zero and epsilon exploitation
if (m <= epsilon) {
    // enforce white if the color would be black
    player.chatcolor = rgb(1.0, 1.0, 1.0);
} else {
    double factor = 1.0 / m;
    player.chatcolor = rgb(r * factor, g * factor, b * factor); 
}
sidenote:
  • don't let people input the floating point epsilon or else the calculated factor will be 0, wich results in black chat color.
    just write a unit test for that.
    it's also a good idea to only allow positive numbers. (i don't know if you currently do)
examples:
  • 0.02 0.19 0.012 would become 0.105263158 1 0.063157895 through the suggested pseudocode from above
    (image taken during a night cycle)
    unreadable dark and bright example
    unreadable dark and bright example
    K3bwj2s.png (197.29 KiB) Viewed 12127 times
    the following is essentially unreadable even if you scale it up.

    note the fact that the artefacts you see are straight from steam in home streaming and not screenshot image compression.
    sad chat text color example
    sad chat text color example
    slPWxbT.png (750.09 KiB) Viewed 12127 times
    bright text like the bright green, orange and white in this screenshot are perfectly readable even at a distance.

    greetings from a fellow german software engineer :)
PS: i'll not step away from using steam in home streaming to get more readable text, since using wifi would introduce udp package loss that could result in undesired desyncs.
PPS: someone should fix your phpbb forum css to allow formatting as above. maybe just introduce paragraphs into bbcode. (i just wrapped the text content in
  • wich is a bad thing. i've dealt with phpbb source code before so.. i know it's possible without modding it)

Re: enforce player chat color to be readable

Posted: Tue Feb 13, 2018 7:30 pm
by exi2163
I think it is a good idea to make text more readable. I remember other games mitigating the observed effect via darkening the background of the chatbox so besides brightening the general player color a customizable effect on the chat (with option to turn off) background when open would be nice.

If you want to go the full way, i think the chat window should be moveable, resizeable and have scrollbars in it and all settings custzomizeable and saved with user settings.
Might be something for 0.18 though.

Re: enforce player chat color to be readable

Posted: Tue Feb 13, 2018 7:45 pm
by GottZ
as a matter of fact i already know the game has two separate values for player color and player chat color. (yes, you can essentially write in a different color than your entity is colored in when assigning a different chat color to your entity)

so i'd say transforming my pseudocode into in game code would be a piece of cake. this could even be possible in the next 0.16 release due to it's tiny footprint :)

about the scrollbars.. yes. this would make catching up the chat after leaving for lunch or similar so much more possible :D (keep in mind the map file has a chat log actually.)
also clickable links would be awesome.

but honestly.. i think a scrollbar (though being a really good idea) and clickable links (also a time saver) are not really something to worry about before RC1 in my opinion since both require changes in the GUI framework itself (i think) :D
but that's just it. an opinion.

Re: enforce player chat color to be readable

Posted: Wed Feb 14, 2018 12:33 pm
by Dupl3xxx
One thing that would be interesting is being able to set a player's text colour separate from their 'ingame' colour. For larger multiplayer games, I don't mind people's characters being whatever colour they so choose, but I'd really like for people to have a set colour in text. Maybe a very slight tint towards their colour. Again, if those could be separated, you could implement what you want yourself. Imagine all normal players being white, with 'supporters' being a bright orange, and admins being a bright blue. Simple and easy and adds some additional info instead of allowing the text to become unreadable. I often find myself going for a brighter player-colour just to make the text more readable as opposed to how my character etc looks ingame.

Re: enforce player chat color to be readable

Posted: Wed Feb 14, 2018 1:08 pm
by GottZ
Dupl3xxx wrote:One thing that would be interesting is being able to set a player's text colour separate from their 'ingame' colour…
that's totally possible right now through modding since each player has two color values assigned. one for the player name / item color and one for chat color.
my proposal simply addresses that this fact should actually be taken into consideration to cause a fix for this issue that does not even take 5 minutes to implement into the game.

yes, while this is possible through a mod, i highly disagree that this should be inside a mod.
if this is not dictated to everyone then nobody will use that particular mod. in addition to that, something trivial as this should not disable achievements.
that's why i suggest this to be added into the main game rather than becoming a ignored mod.

Re: enforce player chat color to be readable

Posted: Wed Feb 14, 2018 9:30 pm
by Klonan
Ok, for the next version the chat color when set through the /color command will be brightened

Image

Re: enforce player chat color to be readable

Posted: Wed Feb 14, 2018 11:33 pm
by BenSeidel
Thank you.

Re: enforce player chat color to be readable

Posted: Thu Feb 15, 2018 3:58 am
by GottZ
awesome!
was as easy as i thought right?

Re: enforce player chat color to be readable

Posted: Thu Feb 15, 2018 6:59 pm
by GottZ
hm. i just noticed 0 0 0 is kinda unreadable on top of stone and concrete.

but still.. nice change.

Re: enforce player chat color to be readable

Posted: Thu Feb 15, 2018 7:32 pm
by darkfrei
Why the red is so gray?
How it looks like now:
2018-02-15 20_29_09.png
2018-02-15 20_29_09.png (3.67 KiB) Viewed 10349 times
How it looks must be:
2018-02-15 20_29_09_must_be.png
2018-02-15 20_29_09_must_be.png (3.53 KiB) Viewed 10349 times

Re: enforce player chat color to be readable

Posted: Thu Feb 15, 2018 9:39 pm
by GottZ
darkfrei wrote:Why the red is so gray?
How it looks like now:
2018-02-15 20_29_09.png
How it looks must be:
2018-02-15 20_29_09_must_be.png
set it to purple. it will be harder to read. just saying this decrease in saturation adds to readability alot.