Modding Help Colour Options Editing

Discussion in 'Starbound Modding' started by kitsunespirit, Dec 24, 2013.

  1. kitsunespirit

    kitsunespirit Cosmic Narwhal

    Code:
      "colorOptions" : [
        /* PURPLE */
        { "ffca8a" : "d29ce7", "e0975c" : "a451c4", "a85636" : "6a2284", "6f2919" : "320c40" },
        /* BLACK */
        { "ffca8a" : "838383", "e0975c" : "555555", "a85636" : "383838", "6f2919" : "151515" },
        /* GREY */
        { "ffca8a" : "b5b5b5", "e0975c" : "808080", "a85636" : "555555", "6f2919" : "303030" },
        /* WHITE */
        { "ffca8a" : "e6e6e6", "e0975c" : "b6b6b6", "a85636" : "7b7b7b", "6f2919" : "373737" },
        /* RED */
        { "ffca8a" : "f4988c", "e0975c" : "d93a3a", "a85636" : "932625", "6f2919" : "601119" },
        /* ORANGE */
        { "ffca8a" : "ffd495", "e0975c" : "ea9931", "a85636" : "af4e00", "6f2919" : "6e2900" },
        /* YELLOW */
        { "ffca8a" : "ffffa7", "e0975c" : "e2c344", "a85636" : "a46e06", "6f2919" : "642f00" },
        /* GREEN */
        { "ffca8a" : "b2e89d", "e0975c" : "51bd3b", "a85636" : "247824", "6f2919" : "144216" },
        /* BLUE */
        { "ffca8a" : "96cbe7", "e0975c" : "5588d4", "a85636" : "344495", "6f2919" : "1a1c51" },
        /* PURPLE */
        { "ffca8a" : "d29ce7", "e0975c" : "a451c4", "a85636" : "6a2284", "6f2919" : "320c40" },
        /* PINK */
        { "ffca8a" : "eab3db", "e0975c" : "d35eae", "a85636" : "97276d", "6f2919" : "59163f" },
        /* BROWN */
        { "ffca8a" : "ccae7c", "e0975c" : "a47844", "a85636" : "754c23", "6f2919" : "472b13" }
    Could someone explain to me what these numbers are? I know that they are colour codes, but why so many? Are they different shades of purple, white, red and so on?

    Also, if I want an item to be just the colour of the sprite itself, do I delete the whole options array?
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    These are Hex Colors
    http://www.colorhexa.com

    These are simply stating what are the acceptable colours within that range.
    So only choose these red colours only these brown etc.

    If you delete the whole options - it won't have colours.
    Anyway don't be afraid to experiment with it - as you will. If you backup the file you have nothing to worry about

    And always share the results of experiments to help others
     
    kitsunespirit likes this.
  3. Karmos

    Karmos Space Penguin Leader

    I'm going to take a little while to explain this in depth.

    Ok, so you want to design a wide variety of items—all the items, randomly generated and otherwise, that a game like Starbound has to offer. You also want to make these items customizable with dyes so that players can change their colors. But in order to do this, it seems, you need to make a whole lot of sprites for each image. Every individual sprite would need one additional version for each dye color you wanted to add. Problem, right?

    No, not a problem! Instead of making a ton of versions of each sprite, you make each sprite with pixels that are placeholder colors where you want parts of that image to change with dye.* So, you see the four repeating columns in that color code you posted above, the
    Those four hex values (a hex value is a six letter/numeral combination that represents a color, normally written with a preceding # but not written with #s in Starbound code) I've outlined are all placeholder colors. That means that that color (#ffca8a) will change into whatever color, the xxxxxx, that is on the other side of the colon (#d29ce7) when using a particular dye (purple).
    And so on for #e0975c being swapped with #a451c4 and #a85636 being swapped with #6a2284 and #6f2919 being swapped with #320c40.

    From left to right, ffca8a to e0975c to a85636 to 6f2919 is light to dark. If you look through the game's asset image files, you'll see a whole lot of peach colors. Those ubiquitous peach colors are the four placeholder colors #ffca8a, #e0975c, #a85636, and #6f2919.

    [​IMG]
    (The yellows in the picture above will appear yellow when rendered in game because they are not placeholder colors. The peaches will correspond to whatever colors are set in the colorOptions section.)

    If you don't want an item or part of an item to be dyeable, just don't use those placeholder colors in that item or in that part of the item, and don't worry about editing out the colorOptions. (I imagine you can remove the colorOptions section safely, but I'm not sure.) There are plenty of items that do this already. If you do want part of an item to be dyeable, use the placeholder colors. You can even set it up to respond differently to dye by changing the code you originally listed. E.g. you could change the colors on the right side of the colon in the /* PURPLE */ section to darker purples, or even to yellows if you wanted to. This also means you can change what colors are being used as placeholder colors.

    *Though there are certain assets that do just have differently pre-colored versions rather than .pngs with placeholder colors. I think these are all objects, i.e. placeable items, like chairs, doors, etc., and I'm not sure why they don't use placeholder colors. Perhaps because they use more than four colors that need to change (they're more complexly shaded because they're larger), and the game is only set up to handle four color substitutions for a given item/object.

    To figure out what color a pixel is, use an eyedropper tool in something like Photoshop or the Gimp and check the color's details. The hex value should be displayed.

    Also: I think the order of the lines in the colorOptions section is hardcodedly tied to ingame dyes. So the section that starts /* RED */ will be what red dye changes the item to even if the /* RED */ header is changed to /* PURPLE */ etc. So take the original order into account when playing around with stuff.

    Let me know if that doesn't make sense.
     
    Last edited: Dec 25, 2013
  4. kitsunespirit

    kitsunespirit Cosmic Narwhal

    Karmos: That was the best explanation I've seen. Thank you. Was really easy to understand too. From what I hear though, dying weapons doesn't work just yet though (not implemented), I don't really need to worry about it just yet.
     
  5. Karmos

    Karmos Space Penguin Leader

    Awesome. Yeah, I'm not sure which items can or can't be dyed. Not sure where in the code that is decided.
     
  6. Schala

    Schala Subatomic Cosmonaut

    I know what hex is, but what I don't get is this light-dark swapping nonsense. For example, WHITE is simply ffffff in hex, BLACK being 000000, yet I see a map entry for it and none of them are that. I think I'll need some ellaboration, if you could. Thanks.
     
  7. Junion

    Junion Subatomic Cosmonaut

    Schala:
    You'll probably notice the 'white' and 'black' options both have very high or very low valunes (instead of ffffff, or 000000)

    There are multiple reasons for this.and none of it has anything to really do with programming..and instead with color space, color theory and so on (basically art based stuff).

    But to keep the answer short, they purposefully don't use true black or true white...because it looks better and more natural to use near colors. If you want the long answer you'll need to look up color theory, shading, highlights, color space..and a whole bunch of other color theory things.
     
  8. Karmos

    Karmos Space Penguin Leader

    White and black don't factor into the color substitution that is taking place, at least not by default. The four colors that are repeated in the colorOptions section, #ffca8a, #e0975c, #a85636, and #6f2919, are swapped with whatever values are on the opposite side of the colons in the code. When I described some colors as "light" or "dark" it was only to help kitsunespirit make sense of the existing images, in which there are four peach tones, some lighter, some darker, and why the hex values are ordered as they are in the code.
     
  9. Schala

    Schala Subatomic Cosmonaut

    Oh, so they swap the colors in the palette of, say, a brown shirt graphic?
     
  10. Karmos

    Karmos Space Penguin Leader

    Yeah, anything that has the four default peach-y colors #e0975c, #a85636, and #6f2919 and a colorOptions section in the item's JSON file.
     
  11. Schala

    Schala Subatomic Cosmonaut

    I get it now! Thanks! That's actually a really smart feature.
     
  12. Eixumau

    Eixumau Void-Bound Voyager

    if that is how the "ColourOptions" works, how about the "Palette", because ColourOptions doesnt work for guns, but i cant get "palette" to work either, even though it works on the default guns
     
  13. Ph33rSnipa

    Ph33rSnipa Void-Bound Voyager

    Answer me this: I've changed the colour palette of my sword to include three colours it normally doesn't (three shades of green) and I have them set to three shades of red. Once on a server, people see that fine. However, I changed the palettes of my clothes and cape the exact same way, (to make the cape black and the clothes darker) but no one can see that change. Any idea what I'm doing wrong?

     
  14. dw420

    dw420 Void-Bound Voyager

    Thanks for the info :)
    Any idea if we have to abide to the 11 colour maximum and the respective dyes?

    ie Is there a way to create X more colouring options and if so, where would one define which "xxxdye.item" does what?

    Thanks

    -edit : i guess my mind decided to ignore the hardcoded line the first time reading your post....causing this redundant post.
     
    Last edited: Jan 9, 2014
  15. Karmos

    Karmos Space Penguin Leader

    It would be helpful to me if you pointed out which color values are important in all that mess. Have you actually dyed your clothing?
     
  16. Karmos

    Karmos Space Penguin Leader

    Yeah, for all I know, it's hardcoded.
     
  17. LaznAzn

    LaznAzn Void-Bound Voyager

    Swords are their own entity while armors are not. What I mean is weapons will carry their own stats and when modded can retain those stats when passed from player to player.
    Armor, however, do not carry stats. If you mod your armor to generate a glow and give it to another player they will not have the glow.

    I'm not sure PRECISELY how it works but basically if you change anything in the armor file it's a client-side only change.
    If you get a modded weapon in single player and bring it server-side it will carry those stats with it.

    One exception to this rule is if the armor is dyed. However if you dye the armor by changing the colorOption of the armor file, that is the problem. Any change to the armor file itself is client side only.

    Basically if you change the second colorOption (black), people will see the armor dyed black even if you see it as your custom palette.

    The only way to use your own custom palette and have it work server side is to use a directive at the moment.

    EDIT: Quoted the wrong post. Derp.
     
    Last edited: Jan 9, 2014
  18. Chandrak

    Chandrak Phantasmal Quasar

    Check out the post HERE. Basically, what people said is correct: armor and weapon palettes and such doesnt actually get coded into the item if all you did was recolor the pngs, but I bet if you follow that guy's instructions, since the data will be in the item you crafted, it should show up properly to other people then.
     
  19. dw420

    dw420 Void-Bound Voyager


    That method is ok for a single recolouring....if not just replacements.

    If someone tried doing 20 variants of the same item...the result would be 20 identical icons with identical descriptions in their crafting table and no recipe variation between them....resulting in worse clutter than doing the actual recolourings.
     
  20. LaznAzn

    LaznAzn Void-Bound Voyager

    The icon changes color as well, see the screenshots for examples.
     
    dw420 likes this.

Share This Page