enforce player chat color to be readable

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

enforce player chat color to be readable

Post 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 11968 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 11968 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 11968 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)
Last edited by GottZ on Wed Feb 14, 2018 4:18 pm, edited 4 times in total.
ImageImage

exi2163
Inserter
Inserter
Posts: 38
Joined: Wed Mar 09, 2016 6:50 am
Contact:

Re: enforce player chat color to be readable

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

GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

Re: enforce player chat color to be readable

Post 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.
ImageImage

Dupl3xxx
Inserter
Inserter
Posts: 40
Joined: Sat Mar 07, 2015 6:50 pm
Contact:

Re: enforce player chat color to be readable

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

GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

Re: enforce player chat color to be readable

Post 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.
ImageImage

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5210
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: enforce player chat color to be readable

Post by Klonan »

Ok, for the next version the chat color when set through the /color command will be brightened

Image

BenSeidel
Filter Inserter
Filter Inserter
Posts: 584
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: enforce player chat color to be readable

Post by BenSeidel »

Thank you.

GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

Re: enforce player chat color to be readable

Post by GottZ »

awesome!
was as easy as i thought right?
ImageImage

GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

Re: enforce player chat color to be readable

Post by GottZ »

hm. i just noticed 0 0 0 is kinda unreadable on top of stone and concrete.

but still.. nice change.
ImageImage

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: enforce player chat color to be readable

Post 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 10190 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 10190 times

GottZ
Inserter
Inserter
Posts: 32
Joined: Mon Jul 17, 2017 12:02 pm
Contact:

Re: enforce player chat color to be readable

Post 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.
ImageImage

Post Reply

Return to “Ideas and Suggestions”