Tutorial Optimizing humanoid spritesheets

Discussion in 'Starbound Modding' started by Kawa, May 8, 2014.

  1. Kawa

    Kawa Tiy's Beard

    Ever notice how certain cells in the character sheets are never used? The entire first column is nothing but documentation, and an entire row of climbing frames is unused. Wouldn't it be nice if we could clean that up a bit without leaving actually blank cells in those strips?

    The cells are defined in .frames files in \humanoid. What's funny about these files is that if you were to put copies of 'em in, say, \humanoid\felins, like I did, the PNG files in that directory will use those frame files instead.

    This is the original malebody.frames, with the names data lined out:
    Code:
    {
      "frameGrid" : {
        "size" : [43, 43],
        "dimensions" : [9, 6],
        "names" : [
          [ null, "idle.1",    "idle.2",    "idle.3",  "idle.4",  "idle.5",  "sit.1",   null,      "duck.1" ],
          [ null, "walk.1",    "walk.2",    "walk.3",  "walk.4",  "walk.5",  "walk.6",  "walk.7",  "walk.8" ],
          [ null, "run.1",     "run.2",     "run.3",   "run.4",   "run.5",   "run.6",   "run.7",   "run.8" ],
          [ null, "jump.1",    "jump.2",    "jump.3",  "jump.4",  "fall.1",  "fall.2",  "fall.3",  "fall.4" ],
          [ null, "climb.1",   "climb.2",   "climb.3", "climb.4", "climb.5", "climb.6", "climb.7", "climb.8" ],
          [ null, "swimIdle.1", null,       null,      "swim.1",  "swim.2",  "swim.3",  "swim.4" ]
        ]
      },
      "aliases" : {
        "swimIdle.2" : "swimIdle.1",
        "swim.5" : "swimIdle.1",
        "swim.6" : "swimIdle.1",
        "swim.7" : "swimIdle.1",
        "lay.1" : "run.8"
      }
    }
    If one were to take malebody.png and remove that one column and row like this:
    malebody.png
    Notice how it's smaller than the usual malebody.png?

    And now remove the matching parts from the local copy of malebody.frames:
    Code:
    {
      "frameGrid" : {
        "size" : [43, 43],
        "dimensions" : [8, 5], //<- important!
        "names" : [
          [ "idle.1",    "idle.2",    "idle.3",  "idle.4",  "idle.5",  "sit.1",   null,      "duck.1" ],
          [ "walk.1",    "walk.2",    "walk.3",  "walk.4",  "walk.5",  "walk.6",  "walk.7",  "walk.8" ],
          [ "run.1",     "run.2",     "run.3",   "run.4",   "run.5",   "run.6",   "run.7",   "run.8" ],
          [ "jump.1",    "jump.2",    "jump.3",  "jump.4",  "fall.1",  "fall.2",  "fall.3",  "fall.4" ],
          [ "swimIdle.1", null,       null,      "swim.1",  "swim.2",  "swim.3",  "swim.4" ]
        ]
      },
      "aliases" : {
        "swimIdle.2" : "swimIdle.1",
        "swim.5" : "swimIdle.1",
        "swim.6" : "swimIdle.1",
        "swim.7" : "swimIdle.1",
        "lay.1" : "run.8"
      }
    }
    End result: smaller sheets without compatibility concerns. You're welcome. If you want, you can put the swimming frames to the right and in the corner, neatly removing all nulls, but at the cost of clarity.
     
  2. Maskrising

    Maskrising Subatomic Cosmonaut

    I am a bit confused on how this works? also are you saying this would make my charecter smaller?
     
  3. the420urchin

    the420urchin Pangalactic Porcupine

    Nah, just makes the file size and amount of frames smaller making it more effective and less bulky.
     
    Kawa likes this.
  4. Kawa

    Kawa Tiy's Beard

    At the cost of documentation, but there are alternative means for that.

    I found this out when I realized each hair folder has its own default.frames -- it's default because each style has an arbitrary name, I guess -- and my Felins mod's hairstyles are all in single-cell 43×43 files. There are two things I want to try next: having multiple hairstyles in a single sheet, and changing the sheet order of clothes. The latter should be a simple matter of using different file names like "k_chestf"...

    Update: Yeah, okay. You can't do the hair thing, it seems. Change the sheet layout all you want, but don't expect multiple styles in one file to work.
     
    Last edited: May 10, 2014

Share This Page