Modding Help An interesting issue with a patch file for Draconis Modded race

Discussion in 'Starbound Modding' started by KaleShibata12, Mar 29, 2021.

  1. KaleShibata12

    KaleShibata12 Phantasmal Quasar

    A few daays ago on steaam a user created a patch for draconis that reskins them and adjusts a few details about them as a patch file. here's the issue: none of that patch's skin colors are working. the model works, the horns and hair color works...the only true issue is the skin colors are limited to human colors just like the original draconis mod. that's not supposed to be happening and im at wits end trying to figure it out. having unpaked both to look NOTHING should be causing this issue. so far to troubleshoot it on my end i have tried:

    Testing to see if taking EVERYTHING ELSE out of starbound's mod folder, reinstalling and reverifying files might help. it does not. I have done this multiple times. multiple ways. even tried starting the game without the winglessdraconis patch pak and then starting again once i have added it or anything else back. nothing.

    Adding things that when used together SHOULD cause a crash this includes: using mods that adjust the same things sprite wise. (curiously doing the full dragon reskin and running said patch does not cause a crash which leads me to a couple theories. things that adjust lua files for said thing was next but i imagine that would. and there's no point as thats not what the problem here is. the fact skin colors won't adjust to what the patch pak adds.

    No errors of any kind talking about the mod not properly loading are anywhere in the log. (minus harmless things that have to do with very specific assets not being properly entered in format. these are harmless and have been doing so since draconis mod's last official update some time ago.

    here's what i have noted so far: draconis mod patch or no patch is limited to human race colors for skin. scales and horns work on draconis. horn color selection works on the patch's version. but what that leads me to beleive is something is being done incorrectly by my game, my computer or the patch itself to adjust the skin color palette. since there are no errors i am inclined to think its something not being done on my or the patch's end. and its likely mine. i am no coder. not even close so i wouldn't know how to check.

    That being said im kinda looking for a solution on this...and i feel i have bothered the patch maker enough with something they can't reproduce to fix. any thoughts on how i can get this handled or is it just one of those 'can't fix it' things?
     
  2. Zaakari

    Zaakari Scruffy Nerf-Herder

    Hm, well I downloaded the draconis mod from this site and the wingless dragons mod from Steam. And the skin colours seem to work fine for me; I count 13, which is the same amount listed in the ".species" file. Whereas the human race has 10 different skin colours.

    How many different colours do you see for the draconis when you create a new character?
     
  3. KaleShibata12

    KaleShibata12 Phantasmal Quasar

    I've gotten them both from steam. not sure if thats the issue. however from what i can tell its supposed to include non human skin colors like say blue. but its clearly not doing that.
    Also while humans have 10, the wingless draconis seems to be using those 10 plus the 3 more...which has me a bit confused.

    Unless of course that's the intent. meaning im just silly. I'm kinda not too sure really as the page for wingless draconis does not state what all colors are supposed to be in the patch file, and has a sprite shown on the page using a color you don't have access to. (but i'll say its likely modders choice in the matter when they make it after all)

    Would like to point out ahead of time im not looking to really hellraise the point. i just want to make sure im not creating some error on my end.
     
  4. Zaakari

    Zaakari Scruffy Nerf-Herder

    No worries. I'm happy to help.

    So, it seems the aqua colour that is show on the wingless draconis mod page is not included in the mod. There are some colours commented out, but the closest one was a grey-blue.
    mod_colour.png initial_colour.png

    But, not to worry, adding new colours is fairly easy, once you know how. I took the liberty of creating a small mod to patch the "dragon.species" file adding in the aqua colour. I left it as a folder (rather than packing it) so that you can easily edit it, if you want. Just unzip the contents of "draconis_extra_colours.zip" to your mods directory. You should see the zip folder attached to this post.
    new_colour.png

    This is what the "dragon.species.patch" file looks like:
    Code:
    [
      // Aqua.
      { "op": "add",
      "path": "/bodyColor/-",
      "value": { "ffe2c5" : "79E2E6", "ffc181" : "00CAC9", "d39c6c" : "00A7B4", "c7815b" : "00717C" }
      }
    ]
    
    In the value object you can see there are many hexadecimal keys and values.
    The keys--strings on the left side of each colon ("ffe2c5" for example)--indicate which colour in the draconis body images to replace. The values--strings on the right side of each colon ("79E2E6"" for example)--indicate which colour to use for the replacement. So the keys stay the same for every colour modification, but you can change the values to whatever you like.

    To add more colours, simply add a new patch operation like so (remember to separate the operations with a comma):
    Code:
    [
      // Aqua.
      { "op": "add",
      "path": "/bodyColor/-",
      "value": { "ffe2c5" : "79E2E6", "ffc181" : "00CAC9", "d39c6c" : "00A7B4", "c7815b" : "00717C" }
      },
    
      // Black.
      { "op": "add",
      "path": "/bodyColor/-",
      "value": { "ffe2c5" : "707070", "ffc181" : "303030", "d39c6c" : "202020", "c7815b" : "000000" }
      }
    ]
    
    In the future, I guess it would be worthwhile to ask the mod author if a certain feature is supposed to be in the mod (like the aqua colour)--rather than saying the mod doesn't work properly. However, it is strange that Ryƫketsu used the blue colour in the mod's image, but didn't include it in the mod; so it's not as though your confusion was unmerited.

    - Inability to produce errors -
    Also, you mentioned that you had tried multiple mods that affected the same files, and yet didn't cause errors. This is to be expected. While errors will arise if different mods try to create the same item or object, if they both replace the same file (like an image, for example) then mod priority comes into play, and the file belonging to the mod with the highest priority will get used.

    For example, while I was testing these changes, my patch file didn't work at first, so I had a look at the log file and found that it was getting loaded before the wingless draconis mod. And, since that mod replaces the "dragons.species" file (rather than patching it) my patch's changes were lost once the wingless mod was loaded. So, in my mod's "_metadata" file I upped the priority to one higher than the wingless mod, and added the wingless mod as a requirement (to ensure that the extra colours mod will get loaded after, should the priorities get changed). Now, I could have just used the "requires" array to ensure that my mod gets loaded after the wingless mod--and I tried that--but then both mods were getting loaded before the draconis mod, and thereby effecting no change. Therefore, I used both "priority" and "requires".
     

    Attached Files:

    Last edited: Apr 2, 2021
  5. KaleShibata12

    KaleShibata12 Phantasmal Quasar

    I do appreciate the explanation! couple things though:

    as im fairly bad at recognizing the color type grid used by games like this I do want to know if there's a way to visually show the hexadecimals for such or for colors. as for the coding string i'm going to assume each of the individual parts that make up the whole sprite is what the key is saying and you're designating a color on that grid as a replacement for that option slot on the right? (i'm....kinda slow when it comes to understanding. but visual aids can help a lot faster. i kinda get it though.)

    as for the patching the thing i assume you need something for text like wordpad and then proper formatting spaces and start/ breaks in lines too.
     
  6. Zaakari

    Zaakari Scruffy Nerf-Herder

    - Hexadecimals -
    So, as colour in real life is made up of light in some combination of the three primary colours: red, green and blue; so it is similarly represented in games. When a colour is defined, it is given values for red, green and blue (and sometimes alpha, for transparency). Depending on the system used, the maximum value for each colour can be represented in different ways. Sometimes the maximum value is a float (1.0), sometimes an integer (255), sometimes hex values (FF), etc. Often the maximum is some form of 255. Why it is has to do with memory in a computer (you can look up why yourself, if you'd like, just know that often the max is 255). In Starbound hex codes are used. This means each "number" is base 16 rather than base 10, so
    Code:
    0 = 0
    1 = 1
    2 = 2
    3 = 3
    4 = 4
    5 = 5
    6 = 6
    7 = 7
    8 = 8
    9 = 9
    A = 10
    B = 11
    C = 12
    D = 13
    E = 14
    F = 15
    
    13 = (16 * 1) + 3 = 19
    A4 = (16 * 10) + 4 = 164
    The maximum value for a colour is 'FF' (which equals 255). In most places, uppercase or lowercase characters are acceptable (ff or FF), but uppercase is more common.

    Anyway, long explanation, but that's sort of how it works. Therefore the colour "ffe2c5", would be 255 red (ff), 226 green (e2), and 197 blue (c5). Depending on the graphics editor you use, you can enter enter these values for a colour, and it will visually show you what it looks like (I don't remember if "paint" does or not). Otherwise, you can use a site like color-hex to enter different values and see what colour they represent. Note, however, that often hex values are preceded by a hash (#) to tell the programs/websites that it is a hex value (so #ffe2c5).
    colour_hex.png

    - Colour Replacement -
    Right. So each race has a bunch of files in the "/humanoid" folder which contain a bunch of images and whatnot that define what the species looks like. The draconis mod adds their files under "/humanoid/dragon", and in that folder there is are files named "malebody.png" and "femalebody.png" (among others).
    humanoid_folder.png
    These images are designed using a few common colours for each sprite. These colours are the "keys" we talked about earlier. If you were to open one of these images, you could use the eyedropper tool to select a colour and see its hexadecimal value. Here an example using GIMP:
    eyedropper.png
    In that picture I have selected the lightest skin shade. And you can see it's hex value in the box labeled "HTML notation" is "ffc181".

    Furthermore, if you were to look at the "dragon.species" file, you would see several different arrays named "bodyColor", "undyColor" and "hairColor" which look like this:
    Code:
    "bodyColor" : [
    //{ "ffe2c5" : "DBD5E5", "ffc181" : "B7A9CC", "d39c6c" : "9A8BB2", "c7815b" : "7F6E99" }, // Light purple.
    //{ "ffe2c5" : "FFE83F", "ffc181" : "FFB43F", "d39c6c" : "FF8C3F", "c7815b" : "FF6B3F" }, // Yellow.
    //{ "ffe2c5" : "FFFCE3", "ffc181" : "FFECC9", "d39c6c" : "FFD3B7", "c7815b" : "EDAE9A" }, // White.
      { "ffe2c5" : "FFF9E3", "ffc181" : "FFECC9", "d39c6c" : "FFD0A6", "c7815b" : "EDBA9A" },
      { "ffe2c5" : "FFFAEE", "ffc181" : "FFE1C5", "d39c6c" : "F5BBA3", "c7815b" : "E49D8E" },
      { "ffe2c5" : "FFEDE3", "ffc181" : "FFCBB7", "d39c6c" : "ED9A9C", "c7815b" : "DB8E9B" },
      { "ffe2c5" : "FFE4B2", "ffc181" : "FFBD80", "d39c6c" : "CC8E66", "c7815b" : "9A624D" },
      { "ffe2c5" : "FFD8B2", "ffc181" : "FFB68D", "d39c6c" : "DC826D", "c7815b" : "B6615A" },
      { "ffe2c5" : "F4E7C7", "ffc181" : "DBA06D", "d39c6c" : "A86749", "c7815b" : "76422F" },
      { "ffe2c5" : "E7BB9A", "ffc181" : "DB8C6D", "d39c6c" : "A85C4D", "c7815b" : "763F34" },
      { "ffe2c5" : "C2835A", "ffc181" : "A86749", "d39c6c" : "76422F", "c7815b" : "5B3122" },
    //{ "ffe2c5" : "D6DDFF", "ffc181" : "9CA7E5", "d39c6c" : "8691CC", "c7815b" : "6974B2" }, // Light blue.
      { "ffe2c5" : "C2735A", "ffc181" : "A85C4D", "d39c6c" : "763F34", "c7815b" : "5B2E22" },
      { "ffe2c5" : "90543B", "ffc181" : "774235", "d39c6c" : "562E27", "c7815b" : "47241E" },
      { "ffe2c5" : "E4C0A6", "ffc181" : "C29784", "d39c6c" : "AC5E54", "c7815b" : "8C4346" },
    //{ "ffe2c5" : "E7ECCF", "ffc181" : "D4DFA0", "d39c6c" : "B2B884", "c7815b" : "A7A871" }, // Limish yellow.
      { "ffe2c5" : "ffe9d3", "ffc181" : "ffc181", "d39c6c" : "d39c6c", "c7815b" : "b97551" },
    //{ "ffe2c5" : "B28B8B", "ffc181" : "B15C5C", "d39c6c" : "934D51", "c7815b" : "8A414D" }, // Light maroon
      { "ffe2c5" : "FFFFCE", "ffc181" : "F2EBAB", "d39c6c" : "D8C984", "c7815b" : "BFA161" }
    //{ "ffe2c5" : "CC9E9E", "ffc181" : "CC6867", "d39c6c" : "A9565A", "c7815b" : "9F4956" }, // Light maroon
    //{ "ffe2c5" : "ABC2CC", "ffc181" : "7DA3B7", "d39c6c" : "6B90A3", "c7815b" : "547A8E" }, // Pale blue (greyish).
    //{ "ffe2c5" : "BBBBBB", "ffc181" : "A5A5A5", "d39c6c" : "868686", "c7815b" : "757575" }, // Medium grey.
    //{ "ffe2c5" : "5F5F5F", "ffc181" : "545454", "d39c6c" : "444444", "c7815b" : "3C3C3C" }, // Dark grey.
    //{ "ffe2c5" : "FFD1F6", "ffc181" : "F2B5EC", "d39c6c" : "D797D8", "c7815b" : "BB7CBF" }, // Light pink
      ],
    
    bodyColor targets the male/female body and head images, undyColor target the male/female body images, and hairColour targets the images contained within the "/humanoid/dragon/hair" folder. bodyColour generally targets the beige/yellow colours in the images, whereas undyColour generally targets the red colours in the images.

    - Text Editors -
    For editing code, I would advise against wordpad and the like as that's more for writing/editing documents that you want to print. It would be kind of slow, and most of its features would be unnecessary and unhelpful for coding. You could notepad, but it's fairly bare-bones. A popular editor would be notepad++ which I use myself on occasion. It has some nice features like: line numbers, bracket matching, syntax highlighting, etc.

    - Formatting -
    Spaces and line breaks often don't mean anything to code, so the "bodyColor" array above could be written on one line and still work. However, such formatting is extremely useful for people to be able to read and understand the code. There isn't really a right or wrong way to format the code, just common or uncommon ways. But you should format it in a way that makes it easier for you understand. For example, the "bodyColor" array could also be written as:
    Code:
    "bodyColor":
    [
      // Light purple
      // { "ffe2c5" : "DBD5E5",
      //   "ffc181" : "B7A9CC",
      //   "d39c6c" : "9A8BB2",
      //   "c7815b" : "7F6E99"
      // },
    
      // Yellow
      // { "ffe2c5" : "FFE83F",
      //   "ffc181" : "FFB43F",
      //   "d39c6c" : "FF8C3F",
      //   "c7815b" : "FF6B3F"
      // },
    
      // White
      // { "ffe2c5" : "FFFCE3",
      //   "ffc181" : "FFECC9",
      //   "d39c6c" : "FFD3B7",
      //   "c7815b" : "EDAE9A"
      // },
    
      { "ffe2c5" : "FFF9E3",
        "ffc181" : "FFECC9",
        "d39c6c" : "FFD0A6",
        "c7815b" : "EDBA9A"
      },
    
      { "ffe2c5" : "FFFAEE",
        "ffc181" : "FFE1C5",
        "d39c6c" : "F5BBA3",
        "c7815b" : "E49D8E"
      },
    
      // etc.
    ],
    
    Of course brackets ('{', '(', '[') commas (,) semi-colons (';') and quotes (") are important. Also double slashes (//) represent comments which mean that the code following (on the same line) is ignored (does nothing).
     
    Last edited: Apr 3, 2021
  7. KaleShibata12

    KaleShibata12 Phantasmal Quasar

    Hell of a detailed explanation. I absolutely appreciate help understanding this kind of stuff. ( i have a modest interest in knowing how to do stuff like this, but lack an ability to stay focused enough on it for the time it can take)

    As for metadata, its basically the same general bracket/comment/ separation style i noticed, but i could probably look up a short guide on that in a bit of time. Thanks for helping me figure this stuff out though! absolutely want to try it when i get enough time set aside later on!
     
  8. Zaakari

    Zaakari Scruffy Nerf-Herder

    Yeah, it probably helps to start simple, making smaller modifications until your knowledge and experience grows.

    As for guides, the starbounder wiki has some useful ones. There is even one for the metadata file.
     
  9. KaleShibata12

    KaleShibata12 Phantasmal Quasar

    Thank you so much for your help and the handy guide sources. I definately appreciate it!
     
  10. Zaakari

    Zaakari Scruffy Nerf-Herder

    You're welcome.
     

Share This Page