Widget: Common Colors

Widget: Common Colors

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Widget: Common Colors

Post by CarRepairer »

This widget overrides team colors.

Features:
  • Assigns consecutive colors to teammates from a colorwheel that I put together.
  • If two people are using this widget they will both see the same colors assigned to the game's teams.
  • Colors should change from game to game (see technical info).
  • Works with ZK's Simple Team Colors minimamp button.*
* You must disable the Local Team Colors widget then enable this one. If it's already enabled, disable/enable again. Failure to do so will cause the button press to enable ZK's widget again.

I did my best to throw together a color wheel where the colors are distinct enough. I used HTML color code names. Type /luaui commoncolors to see the color names and to whom they are assigned.

Technical stuff:

In order to maintain variety between games it needs to choose a random starting position on the colorwheel, but that random spot must be the same for all users of the widget so it needs a common piece of info. Since the GameID is almost impossible to get and many other methods were deemed unfit (for example player names and IDs may change throughout the course of the game if people drop or midgame-join) the only two stable criteria I could think of were map name and team count. If any of map name, player count, or player team ID assignments change at all then you'd have variety between games.


Version 0.004
Attachments
gui_common_colors.lua
(6.51 KiB) Downloaded 24 times
Last edited by CarRepairer on 28 Sep 2013, 21:58, edited 4 times in total.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Widget: Common Colors

Post by Google_Frog »

I'd like to use this but Teal Culture is too strong. The alternative is to write a widget which parses chat such that one player can say green and the other player will receive blue such that they are talking about the same player.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Widget: Common Colors

Post by zwzsg »

CarRepairer wrote:I did my best to throw together a color wheel where the colors are distinct enough.
To have distinct colors, in my widget I split evenly the hue, set saturation to max and lightness around middle, then do a HSL->RGB conversion. Here's the code I use: http://pastebin.ca/2458794
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: Widget: Common Colors

Post by luckywaldo7 »

Google_Frog wrote:I'd like to use this but Teal Culture is too strong. The alternative is to write a widget which parses chat such that one player can say green and the other player will receive blue such that they are talking about the same player.
This is pretty much the best solution I have ever heard to anything.

Although I for one think it's about time we get this Magenta Revolution into gear anyway.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Widget: Common Colors

Post by CarRepairer »

zwzsg wrote:
CarRepairer wrote:I did my best to throw together a color wheel where the colors are distinct enough.
To have distinct colors, in my widget I split evenly the hue, set saturation to max and lightness around middle, then do a HSL->RGB conversion. Here's the code I use: http://pastebin.ca/2458794
Very nice, I like your programmatic approach. In fact, quantum had implemented something like this in Springie at one point.

The problem was, although it's mathematically correct to have hues separated evenly, it didn't always result in colors easy to distinguish by the human eye. ZK games for example tend upwards of 10v10 and some divisions in the color space were harder to distinguish like dark blues, probably to do with our lacking in blue cones or something.

Trying your widget, some colors I'd consider a little too close, and there might not be any way to decide that other than experimentation and choosing a hardcoded list of colors as I did (still not easy to find 20 colors for 10v10 games but I did my best).

Image
Attachments
screen00060.png
(700.43 KiB) Not downloaded yet
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Widget: Common Colors

Post by zwzsg »

According to this paper, because human vision doesn't respond linearly to increase in luminance, and because our three cones don't have the same weight (making pure blue appear darker than pure yellow), HSV/HSL/HSB are flawed systems. It says to instead use CIE L*a*b* or L*u*v*.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Widget: Common Colors

Post by CarRepairer »

I'd be tempted to try it if not for all the time I'd sweat over trying to comprehend those formulae enough to turn them into lua code. If you gave it a shot, I wouldn't mind.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget: Common Colors

Post by smoth »

luckywaldo7 wrote:Although I for one think it's about time we get this Magenta Revolution into gear anyway.
I miss the days when I was able to post in pink
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Widget: Common Colors

Post by CarRepairer »

A 21 player game. Too much?

Image
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget: Common Colors

Post by smoth »

unrelated but how did they manage to not die off from fps death? Also nah, not too much. IIRC spring can have 32 players?
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: Widget: Common Colors

Post by luckywaldo7 »

That color distribution looks good. And a 21 player game is what I would consider 'worst case scenario' but I guess it's a thing anyway.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Widget: Common Colors

Post by Forboding Angel »

Car, you are my hero. I want to be like you when I grow up.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Widget: Common Colors

Post by CarRepairer »

Thanks forb, just keep drinking your milk, or whatever it is we say to kids.

21 colors is uncomfortable. In the screenshot you can see a couple of pairs that might be hard to distinguish, like cyan & aquamarine or green & darkgreen. That parchment is also a little too close to white, leaving the parchment player unable to easily see which of his icons are selected on the minimap. It's tough to find enough colors. If we were all mantis shrimp this wouldn't be an issue (thanks Picasso for informing me about that theoatmeal piece).

This also lead to a short discussion with jK about how best to apply teamcolor to models. Too much blending leaves the teamcolor less prominent and therefore less distinguishable from similar ones.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget: Common Colors

Post by smoth »

teamplaters and healthbars?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Widget: Common Colors

Post by Forboding Angel »

my only real complaint is that in 1v1 games, the colors chosen are of the same spectrum. Like light pink vs purple. Or teal vs, darker teal.

Should definitely choose colors not in the same spectrum.

And could you throw in a randomizer so that you don't get the same colors all the time on the same map with same number of people?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Widget: Common Colors

Post by CarRepairer »

No because that would break the feature that everyone sees the same colors. See technical info in first post.
msafwan
Posts: 38
Joined: 16 Dec 2010, 14:44

Re: Widget: Common Colors

Post by msafwan »

According to this paper, because human vision doesn't respond linearly to increase in luminance, and because our three cones don't have the same weight (making pure blue appear darker than pure yellow), HSV/HSL/HSB are flawed systems. It says to instead use CIE L*a*b* or L*u*v*. -zwzg
Hi,
To get list of colour that is psychologically "equidistant" from each other, you must use standardized colour palette. Its like the colour palette for "Font colour", except that it has been tested experimentally with many people. Example is: "Munsel Colour Palette"

You can use HTML colour to backtrack to standardized colour & get the RGB
- use this web app(click me) and set colour collection to: "DIN system"

Or... you can browse thru the colour palette one-by-one using this web app(click me) & get the RGB.

There is also source-code for CIECAM02 colour system but you don't need it for static colour (because the purpose of the code is to take account for psychological effect of surrounding colour/dynamic reproduction).
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Widget: Common Colors

Post by Anarchid »

Example is: "Munsel Colour Palette"
LAB/LUV postdate Munsel.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10452
Joined: 24 Jan 2006, 21:12

Re: Widget: Common Colors

Post by PicassoCT »

CarRepairer wrote:Thanks forb, just keep drinking your milk, or whatever it is we say to kids.

21 colors is uncomfortable. In the screenshot you can see a couple of pairs that might be hard to distinguish, like cyan & aquamarine or green & darkgreen. That parchment is also a little too close to white, leaving the parchment player unable to easily see which of his icons are selected on the minimap. It's tough to find enough colors. If we were all mantis shrimp this wouldn't be an issue (thanks Picasso for informing me about that theoatmeal piece).

This also lead to a short discussion with jK about how best to apply teamcolor to models. Too much blending leaves the teamcolor less prominent and therefore less distinguishable from similar ones.
All hail the mantis shrimp molotow cocktail
Post Reply

Return to “Lua Scripts”