Page 1 of 1

A question about how we color custom foods, and an idea.

Posted: Wed Apr 26, 2017 7:02 am
by Smoopadoop
When you put a food item into a custom burger, a new layer appears in the burger, and the color of the layer reflects the food used.

How is this color generated? Is it an average of the colors used in the food's sprite? Is the color assigned to each food within the code, like with reagent colors?

I have a few ideas about making animated sprites without the effort of animating every single clothing item. (I swear I'll finish the animations one day!)
The idea is, simply, to have a few 'template' clothings to put on top of the animated human, and color them based on what the player is wearing.
This means that if custom foods are colored by averaging the color of the foods used in them, can't we use the same code with clothing?

i.e. A player wearing a captain's hardsuit begins a walking animation. The animation chosen is a generic 'armored' sprite, a placeholder until a proper animated sprite for the captain's hardsuit is added.
The generic armored walking animation is then colored with an average of all the colors on the captain's suit, which comes out as the captain's recognizable signature blue.

Ofc, talk about animations fits better in Spriting&Mapping, but I'm here to ask about that color code before I go further into animating.

Re: A question about how we color custom foods, and an idea.

Posted: Thu Apr 27, 2017 12:03 am
by Swindly
Smoopadoop wrote:Is the color assigned to each food within the code, like with reagent colors?
Yes. Each food has a filling_color variable that stores the color used when added to custom foods here.

Re: A question about how we color custom foods, and an idea.

Posted: Fri Apr 28, 2017 10:49 pm
by Alipheese
The foods custom item color is a set color thats coded in.

Re: A question about how we color custom foods, and an idea.

Posted: Sat Apr 29, 2017 9:44 am
by Smoopadoop
well then fuck

Re: A question about how we color custom foods, and an idea.

Posted: Sun Apr 30, 2017 2:40 pm
by Alipheese
Could just make the animations use basic selected color for variants. So a blue jumpsuit for said animation with the color set to blue for one or orange for the other.

Re: A question about how we color custom foods, and an idea.

Posted: Mon May 01, 2017 8:28 am
by Smoopadoop
True, but I didn't want to go through every single clothing item and give it a colour, which is why I wanted to try and automate it.
How else would I be able to select the correct colour, though? There must be some way.

IS there a way to generate an average colour based off of an item's sprite? Can byond analyze the colours of .dmis?

Maybe I could use keywords. If the name contain's "captain's", it'd select dark blue. If any colour name is in a clothing item, it'd choose that colour. Same with clothing types.

Are there any other ways you can think of?

Re: A question about how we color custom foods, and an idea.

Posted: Mon May 01, 2017 3:24 pm
by Swindly
Use the item_color variable clothes already have?

Re: A question about how we color custom foods, and an idea.

Posted: Mon May 01, 2017 3:49 pm
by Alipheese
Swindly wrote:Use the item_color variable clothes already have?
Best bet here.
What youre trying to do doesn't exist to my knowledge and complicates the entire thing more than it needs to be.

Re: A question about how we color custom foods, and an idea.

Posted: Wed May 03, 2017 9:39 pm
by Smoopadoop
Jesus it didnt occur to me that things would already have colour vars inbuilt

Re: A question about how we color custom foods, and an idea.

Posted: Fri May 05, 2017 5:34 am
by Uristqwerty
It is possible to read pixels from an icon, but I doubt it would be worth the performance cost, and there are too many edge cases to handle (animations, movies, color var, underlays, overlays, alpha, directional states?)

Besides, when the colours average to something bland, a human can recognize notable colours and pick a more appealing result. Trying to encode the relevant logic in an automatic system would vastly increase the complexity and further impact server performance.

If it doesn't already do it, I think the best solution is just to detect when a colour hasn't been set, use a sane default for the rest of the round, and log/notify devs that the item type in question is missing data.

Re: A question about how we color custom foods, and an idea.

Posted: Fri May 05, 2017 9:36 am
by Smoopadoop
Uristqwerty wrote:all that shit
yeah honestly this is what I was thinking
machine-made colours would look shit, and if something's missing then tell me to make another animation

now time to try and get motivated to keep making them

Re: A question about how we color custom foods, and an idea.

Posted: Fri May 05, 2017 5:01 pm
by iamgoofball
yeah listen i'll just make it pick a color by taking the average color of the sprite