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

How, what and why to code in BYOND.

Moderators: MisterPerson, Code Maintainers

Smoopadoop
 
Joined: Thu Sep 24, 2015 8:43 am
Byond Username: Smoopadoop

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

Postby Smoopadoop » Wed Apr 26, 2017 7:02 am #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.

Postby Swindly » Thu Apr 27, 2017 12:03 am #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.

Postby Alipheese » Fri Apr 28, 2017 10:49 pm #286487

The foods custom item color is a set color thats coded in.
Tell me how good or bad of an Admin I was!

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.

Postby Smoopadoop » Sat Apr 29, 2017 9:44 am #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.

Postby Alipheese » Sun Apr 30, 2017 2:40 pm #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.
Tell me how good or bad of an Admin I was!

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.

Postby Smoopadoop » Mon May 01, 2017 8:28 am #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.

Postby Swindly » Mon May 01, 2017 3:24 pm #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.

Postby Alipheese » Mon May 01, 2017 3:49 pm #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.
Tell me how good or bad of an Admin I was!

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.

Postby Smoopadoop » Wed May 03, 2017 9:39 pm #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.

Postby Uristqwerty » Fri May 05, 2017 5:34 am #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.

Postby Smoopadoop » Fri May 05, 2017 9:36 am #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.

Postby iamgoofball » Fri May 05, 2017 5:01 pm #288901

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


Return to Coding

Who is online

Users browsing this forum: No registered users