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

How, what and why to code in BYOND.
Post Reply
Smoopadoop
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Post by Smoopadoop » #285545

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.
Mains:
David Bellic the Scientist (usually)
Guy Fieri the Cook (not anymore)
Swindly
Joined: Wed Jul 27, 2016 5:21 pm
Byond Username: Swindly

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

Post by Swindly » #285702

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.
User avatar
Alipheese
Joined: Sun May 01, 2016 12:56 pm
Byond Username: Daturix
Github Username: Daturix

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

Post by Alipheese » #286487

The foods custom item color is a set color thats coded in.

Screenshots.
Spoiler:
Image
Image
Image
Image
Image
Image
Quotes.
Spoiler:
PKPenguin321 wrote:holy shit that engineering setup
that man deserves a medal
Anonmare wrote:Gee Engie, why does your mom let you have TWO singulos?
The Legend of Scrubs, MD
You are a traitor!
Your current objectives:
Objective #1: They mocked you in life, a lesser janiborg they said. Now they shall know terror.
Objective #2: Hijack the shuttle to ensure no loyalist Nanotrasen crew escape alive and out of custody.
Cuboos wrote: > That god damn engineer who let the singularity loose was a traitor and the only reasonable person on that whole entire station.
Smoopadoop
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Post by Smoopadoop » #286615

well then fuck
Mains:
David Bellic the Scientist (usually)
Guy Fieri the Cook (not anymore)
User avatar
Alipheese
Joined: Sun May 01, 2016 12:56 pm
Byond Username: Daturix
Github Username: Daturix

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

Post by Alipheese » #286945

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.

Screenshots.
Spoiler:
Image
Image
Image
Image
Image
Image
Quotes.
Spoiler:
PKPenguin321 wrote:holy shit that engineering setup
that man deserves a medal
Anonmare wrote:Gee Engie, why does your mom let you have TWO singulos?
The Legend of Scrubs, MD
You are a traitor!
Your current objectives:
Objective #1: They mocked you in life, a lesser janiborg they said. Now they shall know terror.
Objective #2: Hijack the shuttle to ensure no loyalist Nanotrasen crew escape alive and out of custody.
Cuboos wrote: > That god damn engineer who let the singularity loose was a traitor and the only reasonable person on that whole entire station.
Smoopadoop
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Post by Smoopadoop » #287199

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?
Mains:
David Bellic the Scientist (usually)
Guy Fieri the Cook (not anymore)
Swindly
Joined: Wed Jul 27, 2016 5:21 pm
Byond Username: Swindly

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

Post by Swindly » #287254

Use the item_color variable clothes already have?
User avatar
Alipheese
Joined: Sun May 01, 2016 12:56 pm
Byond Username: Daturix
Github Username: Daturix

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

Post by Alipheese » #287265

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.

Screenshots.
Spoiler:
Image
Image
Image
Image
Image
Image
Quotes.
Spoiler:
PKPenguin321 wrote:holy shit that engineering setup
that man deserves a medal
Anonmare wrote:Gee Engie, why does your mom let you have TWO singulos?
The Legend of Scrubs, MD
You are a traitor!
Your current objectives:
Objective #1: They mocked you in life, a lesser janiborg they said. Now they shall know terror.
Objective #2: Hijack the shuttle to ensure no loyalist Nanotrasen crew escape alive and out of custody.
Cuboos wrote: > That god damn engineer who let the singularity loose was a traitor and the only reasonable person on that whole entire station.
Smoopadoop
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Post by Smoopadoop » #288218

Jesus it didnt occur to me that things would already have colour vars inbuilt
Mains:
David Bellic the Scientist (usually)
Guy Fieri the Cook (not anymore)
User avatar
Uristqwerty
Github User
Joined: Tue Mar 17, 2015 12:44 am
Byond Username: Uristqwerty
Github Username: Uristqwerty

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

Post by Uristqwerty » #288819

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.
An Urist from early baystation. Has submitted a few small additions to /tg/station over the years, but is far from the most notable Urist on this codebase.
Smoopadoop
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Post by Smoopadoop » #288850

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
Mains:
David Bellic the Scientist (usually)
Guy Fieri the Cook (not anymore)
User avatar
iamgoofball
Github User
Joined: Fri Apr 18, 2014 5:50 pm
Byond Username: Iamgoofball
Github Username: Iamgoofball

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

Post by iamgoofball » #288901

yeah listen i'll just make it pick a color by taking the average color of the sprite
Post Reply

Who is online

Users browsing this forum: No registered users