Modding Discussion Unprecedented control for Mod Authors over the attributes of Nonstandard races + a personal request.

Discussion in 'Starbound Modding' started by @lias, Apr 14, 2017.

  1. @lias

    @lias 2.7182818284590...

    This...
    [​IMG]
    is Tegan. Yes, I know it's an unusual name, but it's just the one he generated with.

    Now, right off the bat, you might notice there's something a bit... off about Tegan.
    [​IMG]

    For starters, he's got arms coming out of his ears, obviously.
    [​IMG]

    Curiously, their pivot seems to be centered there, too.
    [​IMG]
    "Let's do some renovating!"

    What's more, he's only 2 blocks tall (despite appearances).
    [​IMG]
    "Sure is dark in here..."

    Now at this point, I imagine you're thinking, "Alright, what's the trick? I bet they probably messed with the base files and now everybody looks like that."

    Well...
    [​IMG]
    "I'm different!"
    Maybe not.

    So how can this be? Well, to explain how we got to Tegan, let me retrace my steps and provide a little context.

    At the moment, I'm working on a mod that adds costumes of well-established fantasy monsters that essentially act as character replacers, at least visually, by way of a rarely-used armor function. The first was a Harpy, and I didn't have any problems with it because the arms matched up exactly with the human base. The second monster, a Minotaur, proved to be much more difficult to work with. Being so muscular and broad-shouldered, the Minotaur is naturally taller and wider than the stock characters, and I couldn't find a way to make the arms rotate where they needed to without a: looking awful, or b: sacrificing proportions.

    Unsatisfied with both of these options, I started digging. I knew there had to be some instance of functional players or NPCs with nonstandard proportions somewhere in the vanilla game. And, it didn't take me long to figure out where I'd seen it before, time and time again, the answer quite literally staring me in the face.

    The more astute among you have probably figured out exactly what, or more precisely who, I'm talking about by now...
    [​IMG]
    "Caught red-flippered."
    Yep. These guys.

    The penguin mercs have been around for at least a few major updates now. You can hire them with doubloons, though I doubt anybody does. Show of hands? They always join your crew as a guard, but being a guard means they have to be able to hold and use a gun in their tiny little flippers. So...

    I started looking into them. They're counted as a humanoid species, just like the rest of the races, with the caveat of not being playable. But inside their species file is something very, very interesting.

    Code:
    "humanoidConfig" : "/species/penguinoid.config",
    Appearing in exactly none of the other species, this line of code serves to override the default humanoid.config file by referencing a replacement, in this case the file penguinoid.config, which can be found here,
    [​IMG]
    nestled snugly in the species folder.
    But what is the humanoid.config file in the first place?

    [​IMG]
    The humanoid.config file is the file that dictates and controls most of the more immutable properties that apply to players and NPCs.

    Very important properties, a few of which include
    Code:
      "headRunOffset" : [1, 0],
      "headSwimOffset" : [1, 0],
    
      // Offset for hair and chest when running or falling
      "runFallOffset" : 1,
      // Offset for hair and chest when ducking
      "duckOffset" : -8,
      "headDuckOffset" : [1, 0],
    
      "sitOffset" : -1,
      "layOffset" : -1,
      "headSitOffset" : [0, 0],
      "headLayOffset" : [0, -1],
    
      "recoilOffset" : [-1, 0],
    
    *Animation offsets for body parts

    Code:
      "frontArmRotationCenter" : [-4, -1],
      "backArmRotationCenter" : [-3, 0],
      // The anchor for items held in the front hand
      "frontHandPosition" : [8, -3],
    
      // The pixel difference between the front and back arms, all data for the
      // back arm is calculated by adding this offset to the front arm values.
      "backArmOffset" : [3, 0],
    
    *Arm rotation center and hand anchor placement(!)

    Code:
        // EmoteIdle, Blabbering, Shouting, Happy, Sad, NEUTRAL, Laugh, Annoyed, Oh, OOOH, Blink, Wink Eat Sleep
        //          , normal    , caps    , :)   , :'(, :|     , :D   ,        , :o, :O  ,      , ;)
        "emoteCycle" : [1.0, 0.3, 0.3, 0.3, 1.0, 0.3, 0.5, 1.0, 1.0, 1.0, 1.0, 0.5, 0.3, 1.0],
        "emoteFrames" : [1, 2, 2, 2, 5, 2, 2, 2, 2, 3, 3, 5, 2, 2]
      },
    
      "personalities" : [
        [ "idle.1", "idle.1", [0, 0], [0, 0] ], //standard
        [ "idle.2", "idle.2", [-1, 0], [0, 0] ], //confident
        [ "idle.3", "idle.3", [-1, 0], [0, 0] ], //gunslinger
        [ "idle.4", "idle.4", [-1, 0], [0, 0] ], //heroic
        [ "idle.5", "idle.5", [0, 0], [0, 0] ], //scared
        [ "idle.2", "idle.5", [-1, 0], [0, 0] ], //wonderful
        [ "idle.4", "idle.3", [-1, 0], [1, 0] ], //prepared
        [ "idle.5", "idle.2", [0, 0], [0, 0] ], //fabulous
        [ "idle.4", "idle.1", [0, 0], [0, 0] ], //stoic
        [ "idle.5", "idle.3", [0, 0], [2, 0] ] //nervous
      ],
    
    *Emotes and personalities

    Code:
        "standingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, 0.65], [0.35, 1.22], [-0.35, 1.22], [-0.75, 0.65] ],
        "crouchingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, -1], [0.35, -0.5], [-0.35, -0.5], [-0.75, -1] ],
    
    *Collision polys(!!!)

    Code:
        "mass" : 1.6,
    
        // should keep the player from teleporting through walls
        "maximumCorrection" : 3,
        "maxMovementPerStep" : 0.4,
    
        "liquidFriction" : 13.0,
        "normalGroundFriction" : 35.0,
    
        "groundForce" : 250.0,
        "airForce" : 50.0,
        "liquidForce" : 80.0
    
    *Physics properties, such as friction, weight, the amount of force you can exert while moving, eg. through air, on the ground, or through liquids

    and also the base stats for run/walk speed, jump height and probably more things I haven't tried.

    This is huge. By making one of these easily-edited config files for their race, modders can control practically every physical aspect of their races, from the collision poly to the arm rotation to their physics and more. Everything.

    The days of being limited to human faceswap Star Trek races are over. Through this file, you can finally make your custom races as weird or huge or tiny or tall or wide or flat as you want, and give them the physics, hitboxes, and arm placements to match, and the game will natively support it.

    To all the mod authors and fans of the weird and wonderful reading, I say to you go! Fill the universe with creativity uncompromised by the arbitrary limits that were once imposed upon you and become as gods, masters of creation!

    ...Well, maybe not to that extent, but I'm sure it'll still be plenty helpful. Player sprites can still only be 43x43px, and you can't have more than 2 arms, but everything else is fair game. For the record, it's stupidly easy to set up your own "-oid" file. It took me less than 30 minutes to edit the sprites (huge props to pvtskittles for their race base, great for tinkering) and fidget with the offsets and collision poly to produce Tegan, and I'm almost completely code-illiterate. If I can do it, then I doubt you'll have any problems.

    GOOD LUCK!

    ----------

    Now that the announcement is done with, I'd like to address any coders who may be reading this directly. Obviously this is great for race modders, but the problem I set out to solve in the first place isn't quite solved itself.

    I could split up the costumes into their own individual races to utilize this system, but the reason I didn't make them races in the first place was because I wanted them to be something that could change the way your character looks and plays, but not as a permanent commitment. I'm also against the idea of releasing a race that has nothing going for it beyond visuals, as a new race to me is more than just a fancy skin, but an expansion to the flavor and story of the ingame universe. It's probably not accurate in all cases, but that's how I feel.

    Therefore, if it's at all possible I'd like to stay as true to my original concept as I can, and that's where I need help. Ideally, I'm hoping there's some way to get a player to change which oid.config file it references on the fly and, if possible, apply that temporarily through lua via a status condition via armor.

    If it helps, from observation I've noticed that each time you load the character from the player select screen (but not from /reloading) it updates any edits you've made and saved to the oid.config file. I don't know if that means it's part of the renderer or something that gets bundled as part of the player file, but I don't know much besides some obvious and possibly off-base inferences in the first place. That's why I'm here.

    If somebody does manage to figure it out, please let me know. I'm eager to get back to work. Thank you so much!
     
    DraikNova and Exilyth like this.
  2. Antyrus

    Antyrus Big Damn Hero

    False. You can make them way bigger if you mess with the frame size. Now, I haven't messed with making the hitbox taller, but making sprites bigger is easy. Also, for your costume thing: You can totally hide the player sprite by inserting
    Code:
    "hideBody" : true,
    into a given clothing file. This doesn't solve your arm rotation problem, but it means you can have free reign spriting without worrying about fully covering the player.
     
  3. @lias

    @lias 2.7182818284590...

    That's actually exactly the method my costumes use to hide the player sprite, and also not the problem I'm having. I guess I could've been clearer, sorry. I didn't know you could make them bigger, though, so thanks for that!

    The problem I need solved is finding a way to somehow get armors to either reference or cause the player to reference one of these replacement -oid.config files, as outlined at the bottom of my post, as this seems to be the only way to alter arm rotation anchors on an non-global scale.

    By the way, does the document read OK? I thought I did a decent job formatting it but maybe it needs a TLDR summarizing the major points at the end.

    e: edited for clarity and politeness
     
    Last edited: Apr 14, 2017
  4. DraikNova

    DraikNova Phantasmal Quasar

    I think you might be able to attach a status effect to your armor, which in turn uses a lua script. Lua can do pretty much anything; heck, you can even make Starbound into a first-person shooter using it (see also: Mazebound). If it doesn't allow you to override the oid.config using that, you could always just hide the arms completely and have it display the armor's arms and the item your character is holding using that. It might not work perfectly for throwables, but it's a reasonable workaround.

    Also, I'm definitely going to have to mess around with this file a lot when making my custom spider species (well, I call them spiders, since that's what they are, but they probably look more like a bunch of legs attached to a circular stapler at first glance). Last I heard, making your own oid.config file didn't work properly. If using the override works, I'm going to have a lot less trouble getting some of the hitbox changes and so on to work.
     
  5. DraikNova

    DraikNova Phantasmal Quasar

    I haven't released it yet. Mostly, I'm stuck on the same issue as you are, not knowing how to code in Starbound (or, to be more specific, how to code in Lua), which I'm planning to teach myself during the summer.
     
    Last edited: Apr 15, 2017

Share This Page