Tutorial About Tiles and Custom Ores

Discussion in 'Starbound Modding' started by Kayuko, May 13, 2015.

  1. Kayuko

    Kayuko Oxygen Tank

    So, hello there!
    I'm the lil' foxy, Kayu, and I hereby present my very first tutorial about anything at all (on these forums, at least).
    Please keep in mind that I don't consider myself a good modder at all, at this point, all hail @Kawa , my personal hero.
    That said, I'm not responsible for computer explosions or thermonuclear meltdowns that might or might not happen if you follow this guide.
    So, right to the point!

    Before you do ANYTHING regarding mods, always copy your starbound folder (or at least your giraffe_storage folder somewhere else, look at the copy as if it'd be a development branch, just for you. You can mess around with the files in the second copy as much as you want and still just replace corrupted files, if needed.

    ====================================================================================================

    So, why did I start this (hopefully at some point) tutorial series with Tiles and Ores?
    Thats pretty simple. If you take a look at this game, just imagine there wouldn't be tiles or ores. There wouldn't be much to do, right?

    The basic requirement for everything in modding is only one thing: notepad.
    I highly recommend using notepad++ due to the formatting options (Language settings).
    Makes things a lot easier.

    Second requirement: Learn to read and understand your starbound.log. Theres already a good tutorial for this one, so read it and come back after you did.

    ====================================================================================================

    Severed (I think it was him) once said JSON doesn't require any coding knowledge and it's more like filling out a form. That's why the very first lesson in JSON modding (there's also Lua, but that's another thing) is: You do not need ANY programming knowledge at all.
    Don't stop your idea because you think "JSON? Sounds like Java. Nah, I'm out."
    Really everyone can create Starbound mods with a little patience and experience (the latter is why you're reading this post).

    ====================================================================================================

    So, first of all, Tiles.
    The definition of tiles is actually "block". Dirt, Cobblestone, Iron Ore, even Skyrails. Those are tiles.
    The whole world in starbound is built with tiles. You stand upon them, you dig into them, you swim into them (Okay, that's actually liquid, but nvm that for now).

    Note: This tutorial uses material tiles as examples.

    JSON is extremely simple, but even compared to other stuff, creating tiles is really, really simple.
    All you need is the following:

    xxx.matitem / xxx.png file in your "%assets%/items/materials" directory.
    xxx.material / xxx.png file in your "%assets%/tiles/materials" directory.

    First, let's take a look at the .matitem file.


    {
    "itemName" : "cobblestonebrick",
    "rarity" : "Common",
    "inventoryIcon" : "cobblestonebrick.png",
    "dropCollision" : [-2.5, -2.0, 2.5, 2.0],
    "shortdescription" : "Cobblestone Brick",
    "description" : "Small bricks made of cobblestone.",
    "glitchdescription" : "Statement. Cobblestone.",
    "florandescription" : "Cobblessstone.",

    "materialId" : 132
    }



    "itemName" -- Pretty self explanatory, it's the string the game uses to identify and store this block. Important note would be: it's case sensitive! Declaring CobbleStoneBrick somewhere will NOT produce this item, but a perfectly generic item instead.
    "rarity" -- Pretty much only the border-color of the item. "Common" - White, "Uncommon" - Green, "Rare" - Blue, "Legendary" - Purple.
    "inventoryIcon" -- Location and name of the .png file used as, surprise, inventory icon. (The item how it shows itself once you picked it up). Usually in the same directory as the .matitem file, that's why it's only the name in this example, not the directory.
    "dropCollision" -- Nothing you should be too worried about. These values influences the hitbox of the item once it drops to the ground, preventing it from falling through.
    "shortDescription" -- A little missleading, that's the item name how it's shown in-game. In this case, "Cobblestone Brick".
    "description" -- The description of the item, obviously. You see this when you hover over the item with your cursor.
    "glitchdescription" -- Race-specific inspection strings. If you inspect it with a glitch, it'll say "Statement. Cobblestone.", Florans' say "Cobblessstone."
    "florandescription" -- ^ read thiz
    "materialId" -- Materials aren't only stored as names but also as id's. That's really nothing you should mess that much with. Theres one important thing if you create your own material, tho: Don't use an ID that's already in use. Best start somewhere in the 200's to avoid conflictions.

    Now, the .material part:


    {
    "materialId" : 132,
    "materialName" : "cobblestonebrick",
    "particleColor" : [149, 149, 149, 255],
    "itemDrop" : "cobblestonebrick",
    "shortdescription" : "Cobblestone Brick",
    "description" : "Small bricks made of cobblestone.",
    "glitchDescription" : "Statement. Cobblestone.",
    "floranDescription" : "Cobblessstone.",
    "footstepSound" : "/sfx/blocks/footstep_stone3.wav",
    "health" : 4,
    "category": "materials",

    "renderTemplate" : "/tiles/classicmaterialtemplate.config",
    "renderParameters" : {
    "texture" : "cobblestonebrick.png",
    "variants" : 5,
    "lightTransparent" : false,
    "multiColored" : false,
    "occludesBelow" : true,
    "zLevel" : 0
    }
    }



    "materialId" -- The same as above, make sure both the ID's of the .material and the .matitem files match.
    "materialName" -- The same as itemName, basically, again - make sure they match EXACTLY.
    "particleColor" -- I ... think... that's the think that happens when you harvest them with your pickaxe, the little particles flowing around. It's in RGB format, as almost everything in starbound is (besides hex-code).
    "itemDrop" -- The actual item it drops upon destroying the brick. You could put "fullwood1" there and it would drop Unrefined Wood, for example.
    "shortDescription" -- Look above.
    "description" -- Look above.
    "glitchDescription" -- Look above.
    "floranDescription" -- Look above.
    "footstepSound" -- Well, what would the game be without sounds. That's the file location of the soundfile it uses whenever you're walking on the material block.
    "health" -- Pickaxes for example have a fixed damage value. For example: Pickaxe does 2 damage, block got 4 health, you'd need 2 hits to harvest the block.
    "category" -- This is for the automatic inventory sorting. You might've noticed, but Cobblestone and other materials are automatically put into the tile-inventory (or rather, material bag). Thats what defines if it lands there or in your main bag.
    "renderTemplate" -- So, this is where it defines a lot of things regarding rendering. Like, shadows, where are the corners (to prevent overlapping), how big is this block actually... That's advanced messing around. Just keep the normal template if you don't plan on doing something really big and innovative.
    "renderParameters" -- 'tis an array, see below:
    "texture" -- Location of the texture actually used for the block. Usually in the same directory, so again, it's just the filename.
    "variants" -- Would be boring if all cobblestone bricks would look exactly the same, right? That's where variations are defined. As you can see in the example png there are 5 frames (aka variations).
    "lightTransparent" -- Is it glass? No. So it's not light transparent. I think you know what that actually means.
    "multicolored" -- ... someone help me out there, could never figure out what that's good for.
    "occludesBelow" -- (@Mackinz: OccludesBelow has to do with rendering - basically, if a tile has the function set to true then the tile below it (background tile) cannot display until the tile is removed. I have tested this, and you can see what it does, simply, by making a "o" of wood planks in the background, place a single block in the foreground, and make a small test mod that changes the function from true to false. What will happen is that the border of the wood planks block in the background will disappear, overwritten by the foreground block and setting it to false will eliminate the covering (you'll have to see what I mean through testing)).

    "zLevel" -- Well... another "canonlyguess". I guess it's the layering, you know, as in Trees are usually behind the player, but (in this case) Cobblestone is on the same z (X Y Z Axis system) level as the player.


    With this knowledge you should be able to actually create your own material tile, BUT!
    What now? It's in game. But it's used nowhere. So, we're going to create a custom ore now, example-wise.

    ==================================================================================================

    First, you need to crate an item. The ore itself.
    Here's an example:


    {
    "itemName" : "sermantiumore",
    "rarity" : "Legendary",
    "inventoryIcon" : "sermantiumore.png",
    "description" : "Sermantium Ore.",
    "shortdescription" : "Sermantium Ore",
    "learnBlueprintsOnPickup" :[
    "sermantiumarmorchest",
    "sermantiumarmorpants",
    "sermantiumarmorhead",
    "sermantiumbar"
    ]
    }


    ItemName, Rarity, InventoryIcon, we had all this above.
    There is, however, a new option called "learnBlueprintsOnPickup", we might get to that in another tutorial cause that's completely irrelevant for this one.

    Just fill those things, create a nice .png ([​IMG] ) and you're good to go.

    Notes:
    1. Keep the png at 16x16, or you'll run into trouble later on.
    2. .item files in this case are located ANYWHERE! in the "%assets%/items/" directory. I like to keep order, so in this case the full directory is "%assets%/items/generic/crafting/sermantiumore.item"


    Next up is the tile, that's a little different then the last time since it's not a material but a matmod.
    A matmod is basically a material or an item that "modifies" a block. For example, Iron can be found INSIDE blocks. Like cobblestone, dirt, tar, basically everything. But how would that work? Create a single material for each and every combination? Nope, that's where .matmod files come in.

    They are usually located at "%assets%/tiles/mods/sermantium.matmod".


    {
    "modId" : 80,
    "modName" : "sermantium",
    "itemDrop" : "sermantiumore",
    "Description" : "Sermantium ore.",
    "breaksWithTile" : true,
    "health" : 5,
    "harvestLevel" : 5,

    "miningSounds" : [ "/sfx/tools/pickaxe_ore.wav", "/sfx/tools/pickaxe_ore2.wav" ],
    "miningParticle" : "orespark",

    "renderTemplate" : "/tiles/classicmaterialtemplate.config",
    "renderParameters" : {
    "texture" : "sermantium.png",
    "variants" : 8,
    "multiColored" : false,
    "zLevel" : 0
    }
    }




    "modId" -- Not connected to anything in this case, just choose one that's not taken already. (Note: modId and materialId is not the same thing!)
    "modName" -- You might've noticed that's not sermantiumore but simply sermantium. I'm not even sure if those two would collide, but I like to play safe, that's why I always choose one name for the ore itself and a different one for the mod.
    "itemDrop" -- Look above. You can make it drop a teddy, if you want. But in this case, use the "itemName" of the Ore you want it to drop.
    "Description" -- That's not important at all, really. Nowhere to be seen ingame, it's just a reference for yourself, like a comment.
    "breaksWithTile" -- If sermantiumore is inside the cobblestone and you mine it, you will drop one sermantiumore. If you set this to false, at least that's what I think, it'll just drop one cobblestone and the sermantium will keep floating about. I never messed with this, because, why the heck should I?
    "health" -- Look above, Pickaxe Power vs. Mod Health.
    "harvestLevel" -- To be honest, I don't have a clue what this does. Really.
    "miningSounds" -- Quite obviously the sound you hear when you mine this ore.
    "miningParticle" -- The little particles flowing around when you hit it with a pickaxe. (Note: Particles and their names are defined somewhere else, but that's got nothing to do with this for now. For learning, it'll suffice if you use "orespark".)
    "renderTemplate" -- Look above, already explained.
    "renderParamters" -- Look above, already explained.


    A little addition for variants, here's the actual png file for this item:

    [​IMG]

    As you can see, 8 variations, each one a different shape and (IMPORTANT!) each one at a size of 16x24, pay close attention to the distribution of each variation itself in the png file. Just play a bit with it and you'll notice why it's a bad idea to use different dimensions.

    So, now we have the item itself (sermantiumore) and the block you need to mine (sermantium.matmod).
    That's fine, right?
    Not entirely!
    Now, let's add it to the game:

    The distribution of ores is dependant of the planets threatlevel and surfacelevel. But where is it defined?
    oredistributions.configfunctions ("%assets%/biomes/oredistributions.configfunctions).
    However, we stumble upon another problem here.
    Never, ever - really, never - create a file called "oredistributions.configfunctions" and place it in the directory. It will work, if you do it right, but it WILL collide with about every mod doing nearly the same thing.
    So, use the patch system, but first of all, we're going to explain the filecontent itself again:


    {

    "surfaceOres" : [
    [0.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "iron", 0.20] ] ],
    [1.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "iron", 0.20] ] ],
    [2.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "titanium", 0.20] ] ],
    [3.5, [ [ "coal", 1.40], [ "uranium", 0.50], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "titanium", 0.20] ] ],
    [4.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20] ] ],
    [5.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.20], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20] ] ]

    ],

    "depth1" : [
    [0.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.15], [ "silverore", 1.05], [ "gold", 1.00], [ "platinum", 0.90], [ "diamond", 0.85], ["fossil", 0.79], [ "iron", 1.25] ] ],
    [1.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.20], [ "silverore", 1.15], [ "gold", 1.05], [ "platinum", 0.95], [ "diamond", 0.90], ["fossil", 0.79], [ "iron", 1.35] ] ],
    [2.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.15], [ "silverore", 1.20], [ "gold", 1.15], [ "platinum", 1.00], [ "diamond", 0.95], ["fossil", 0.79], [ "titanium", 1.20] ] ],
    [3.5, [ [ "coal", 1.15], [ "uranium", 1.30], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.10], [ "silverore", 1.15], [ "gold", 1.20], [ "platinum", 1.05], [ "diamond", 1.00], ["fossil", 0.79], [ "titanium", 1.30] ] ],
    [4.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.05], [ "silverore", 1.10], [ "gold", 1.15], [ "platinum", 1.10], [ "diamond", 1.05], ["fossil", 0.79], [ "aegisalt", 1.20], [ "rubium", 1.20], [ "violium", 1.20] ] ],
    [5.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 1.30], [ "copper", 1.00], [ "silverore", 1.05], [ "gold", 1.10], [ "platinum", 1.05], [ "diamond", 1.15], ["fossil", 0.79], [ "aegisalt", 1.30], [ "rubium", 1.30], [ "violium", 1.30] ] ]
    ],

    "depth2" : [
    [0.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.20], [ "silverore", 1.10], [ "gold", 1.05], [ "platinum", 0.95], [ "diamond", 0.90], ["fossil", 0.79], [ "iron", 1.30] ] ],
    [1.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.25], [ "silverore", 1.20], [ "gold", 1.10], [ "platinum", 1.00], [ "diamond", 0.95], ["fossil", 0.79], [ "iron", 1.40] ] ],
    [2.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.20], [ "silverore", 1.25], [ "gold", 1.20], [ "platinum", 1.05], [ "diamond", 1.00], ["fossil", 0.79], [ "titanium", 1.25] ] ],
    [3.5, [ [ "coal", 1.15], [ "uranium", 1.35], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.15], [ "silverore", 1.20], [ "gold", 1.25], [ "platinum", 1.10], [ "diamond", 1.05], ["fossil", 0.79], [ "titanium", 1.35] ] ],
    [4.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.10], [ "silverore", 1.15], [ "gold", 1.20], [ "platinum", 1.20], [ "diamond", 1.10], ["fossil", 0.79], [ "aegisalt", 1.25], [ "rubium", 1.20], [ "violium", 1.20] ] ],
    [5.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 1.35], [ "copper", 1.05], [ "silverore", 1.10], [ "gold", 1.15], [ "platinum", 1.10], [ "diamond", 1.20], ["fossil", 0.79], [ "aegisalt", 1.35], [ "rubium", 1.35], [ "violium", 1.35] ] ]
    ],

    "depth3" : [
    [0.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.25], [ "silverore", 1.15], [ "gold", 1.10], [ "platinum", 1.00], [ "diamond", 0.95], ["fossil", 0.79], [ "iron", 1.35] ] ],
    [1.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.30], [ "silverore", 1.25], [ "gold", 1.15], [ "platinum", 1.05], [ "diamond", 1.00], ["fossil", 0.79], [ "iron", 1.45] ] ],
    [2.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.25], [ "silverore", 1.30], [ "gold", 1.25], [ "platinum", 1.10], [ "diamond", 1.05], ["fossil", 0.79], [ "titanium", 1.30] ] ],
    [3.5, [ [ "coal", 1.15], [ "uranium", 1.40], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.20], [ "silverore", 1.25], [ "gold", 1.30], [ "platinum", 1.15], [ "diamond", 1.10], ["fossil", 0.79], [ "titanium", 1.40] ] ],
    [4.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.15], [ "silverore", 1.20], [ "gold", 1.25], [ "platinum", 1.25], [ "diamond", 1.15], ["fossil", 0.79], [ "aegisalt", 1.30], [ "rubium", 1.30], [ "violium", 1.30] ] ],
    [5.5, [ [ "coal", 1.15], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 1.40], [ "copper", 1.10], [ "silverore", 1.15], [ "gold", 1.20], [ "platinum", 1.15], [ "diamond", 1.25], ["fossil", 0.79], [ "aegisalt", 1.40], [ "rubium", 1.40], [ "violium", 1.40] ] ]
    ],

    "core" : [
    [0.5, [ [ "coal", 1.00], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.25], [ "silverore", 1.15], [ "gold", 1.10], [ "platinum", 1.00], [ "diamond", 0.95], [ "corefragment", 1.50], ["fossil", 0.79], [ "iron", 1.35] ] ],
    [1.5, [ [ "coal", 1.00], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.30], [ "silverore", 1.25], [ "gold", 1.15], [ "platinum", 1.05], [ "diamond", 1.00], [ "corefragment", 1.15], ["fossil", 0.79], [ "iron", 1.45] ] ],
    [2.5, [ [ "coal", 1.00], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.25], [ "silverore", 1.30], [ "gold", 1.25], [ "platinum", 1.10], [ "diamond", 1.05], [ "corefragment", 1.15], ["fossil", 0.79], [ "titanium", 1.30] ] ],
    [3.5, [ [ "coal", 1.00], [ "uranium", 1.40], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.20], [ "silverore", 1.25], [ "gold", 1.30], [ "platinum", 1.15], [ "diamond", 1.10], [ "corefragment", 1.15], ["fossil", 0.79], [ "titanium", 1.40] ] ],
    [4.5, [ [ "coal", 1.00], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 1.15], [ "silverore", 1.20], [ "gold", 1.25], [ "platinum", 1.25], [ "diamond", 1.15], [ "corefragment", 1.15], ["fossil", 0.79], [ "aegisalt", 1.30], [ "rubium", 1.30], [ "violium", 1.30] ] ],
    [5.5, [ [ "coal", 1.00], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 1.40], [ "copper", 1.10], [ "silverore", 1.15], [ "gold", 1.20], [ "platinum", 1.15], [ "diamond", 1.25], [ "corefragment", 1.15], ["fossil", 0.79], [ "aegisalt", 1.40], [ "rubium", 1.40], [ "violium", 1.40] ] ]
    ],

    "moonores" : [
    [0.5, [ [ "plutonium", 0.0], [ "solarium", 0.0] ] ]
    ],

    "moondeepores" : [
    [0.5, [ [ "plutonium", 1.0], [ "solarium", 0.0] ] ]
    ],

    "none" : [
    [0.5, [ [ "copper", 0.0], [ "coal", 0.0] ] ]
    ]
    }



    Thats long, right?
    So, first of all: Ignore all those core, moondeepores, surfaceores things. Those are unimportant for now, since they're defined in the biome and celestialfiles itself, and that's not what this tutorial is about.
    Just keep in mind, if you add an ore, keep the odds fair. For example: If you want it to be found pretty commonly, look at the coal-value. If you want it to be super rare, compare it to the diamond value. And always fill out these things for all surface-levels and threat-levels you want the ore to appear at.

    I'll just copy one important part here:

    [5.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.20], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20] ] ]

    So, thats the "surfaceOres" of a level 6 planet (NOTE: It starts at 0.5, so 5.5 is threatlevel 6, not 5!)

    We want it to look like this:

    [5.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.20], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20], ["sermantium", 0.50 ] ] ]

    The way we go about this is a patchfile:


    [
    {
    "op" : "add",
    "path" : "/surfaceOres/0/1/-", //NOTE: Arrays DO NOT START AT 1! Array numerations always start at 0!
    "value" : [ "sermantium", 0.50]
    }
    ]


    We put this into a file named "oredistributions.configfunctions.patch" and copy this file to the location "%mod%/biomes/".
    More on the complete folder structure in a second.

    So what will this do?
    It will add the value ["sermantium", 0.50] to the FIRST Array-index in surfaceOres. In this case, to threatLevel 0.5.
    Just do this for all surfaceLevels and threatLevels, start the game and you're good to go!

    Okay, now, to get this mod working:

    This is basic knowledge, so keep that in mind!

    Mods are always in their own folders, so create an example and call it "sermantium" for now.
    Open this folder, create a new textfile and rename it "sermantium.modinfo" (NOTE: At this point, unless you pack the mod, the filename itself is not important, the ending ".modinfo" is the important part).

    Example file:

    {
    "name" : "Sermantium",
    "version" : "Beta v. Spr5",
    "path" : ".",
    "requires" : [],
    "includes" : [],
    "metadata":
    {
    "author" : "",
    "version" : "",
    "description" : "",
    "support_url" : ""
    }
    }


    Don't mess with dependencies, requires or includes just yet, that's something more advanced. Just leave them empty.
    The important part is the name. That's what's shown in the lower right corner in the main-menu.

    After you created this file, the fun part starts.

    You have all those fancy files we created at hand, I hope? Okay!
    Then another important lesson.

    Custom Items: Not really bound to subfolders, just put them into the right main directories.
    Replaced / Edited items: Those ALWAYS have the same directory as the original one. For example: the oredistributions.configfunctions.patch HAS TO BE in the /biomes/ folder.

    So, now, create the following folder structure:

    %giraffe_storage%/mods/sermantium/biomes/oredistributions.configfunctions.patch
    %giraffe_storage%/mods/sermantium/items/generic/crafting/sermantiumore.item
    %giraffe_storage%/mods/sermantium/items/generic/crafting/sermantiumore.png
    %giraffe_storage%/mods/sermantium/tiles/mods/sermantium.matmod
    %giraffe_storage%/mods/sermantium/tiles/mods/sermantium.png
    %giraffe_storage%/mods/sermantium/sermantium.modinfo

    Once you've done that, delete your universe folder (you remembered about the starbound copy, right?), start up the game and - tada - if you've done everything right you'll find your new ore. Right there.
    If your starbound client crashes with an error or you can't find / see your ores, really, whatever error might be occuring - read your starbound.log and try to resolve the issue yourself.

    if you just can't figure out what's wrong, I'm always here to help, but trust me - the more you do yourself, the more you learn.

    So, I hope I could help you a little bit at least, please leave sum feedback. :kitten:

    [​IMG]
     
    Last edited: Jun 8, 2015
  2. Mr_Ramych

    Mr_Ramych Void-Bound Voyager

    Following your guide i had trouble with patching. The problem was that in file "oredistributions.configfunctions.patch" instead of your there should be
    Code:
    [
    {
    "op" : "add",
    "path" : "/surfaceOres/0/1/-",
    "value" : [ "sermantium", 0.50]
    }
    ]
    You should fix it as soon as you can.
     
    Kayuko likes this.
  3. Kayuko

    Kayuko Oxygen Tank

    That's right, fixed it in, thanks.
    No idea why I tried to patch it like this.
    (Should be noted that you'd rather use replace anyways, but yeah, if you use add that was wrong)
     
  4. Mackinz

    Mackinz The Waste of Time

    I do not believe that they have to match exactly since you can have a totally different matitem without issue (see: various rock tiles that break into Cobblestone), but having them match does make it easier to make them without issue.

    It's probably worth noting that this could probably be done with any race in the game. The reason you see Glitch and Floran-specific descriptions for materials is because they have unique ways of speaking, unlike a Human, Hylotl, Apex, Novakid or Avian.

    Totally false. Not only does the function not do that, that is only possible with a platform tile. OccludesBelow has to do with rendering - basically, if a tile has the function set to true then the tile below it (background tile) cannot display until the tile is removed. I have tested this, and you can see what it does, simply, by making a "o" of wood planks in the background, place a single block in the foreground, and make a small test mod that changes the function from true to false. What will happen is that the border of the wood planks block in the background will disappear, overwritten by the foreground block and setting it to false will eliminate the covering (you'll have to see what I mean through testing).
     
    Kayuko and Mr_Ramych like this.
  5. Kayuko

    Kayuko Oxygen Tank

    e.e I know that by now too, thanks for correcting tho, will edit it.
    Really no clue how I got to that collision part... lol.
     
  6. lazarus78

    lazarus78 The Waste of Time

    occludesBelow is extremely important for new tile blocks. If its solid and non-transparent, you need it turned on for performance reasons, otherwise your game will try and render twice as many blocks.
     
    Kayuko likes this.
  7. Mackinz

    Mackinz The Waste of Time

    Um, but that also leads to really ugly clipping issues which I touched on when I explained how to test what occludesBelow does.
     
  8. lazarus78

    lazarus78 The Waste of Time

    I said it needs to be on, AKA, true. Every solid block has it turned on.

    Also I noticed no visual difference with either setting.
     
    Last edited: Jun 8, 2015
  9. Mackinz

    Mackinz The Waste of Time

    If I were home, I'd show you exactly what I mean.
     
  10. lazarus78

    lazarus78 The Waste of Time

    Ill await your reply. Im curious now.
     
  11. Mackinz

    Mackinz The Waste of Time

    I finally was able to replicate the issue I know exists.

    OccludesBelow causes this:

    [​IMG]

    Not as easily replicated as I thought, but not exactly hard to do either. I really don't want to patch a file right now, so I'll grab a screenshot with a custom material twice to demonstrate the difference between true and false values for occludesBelow.

    Edit: Custom material demonstration of occludesBelow:

    [​IMG]

    Top is True, bottom is False.
     
    Last edited: Jun 9, 2015
    Kayuko likes this.
  12. lazarus78

    lazarus78 The Waste of Time

    IMO that is a minor thing as opposed to the gain in performance.
     
  13. Panthera Pardus

    Panthera Pardus Subatomic Cosmonaut

    Hello Together,

    I don't know much about Modding Starbound or Modding itself. But it looks like that I found something that isn't known by everyone. At least it is not in the Explanation of the cobblestonbrick.material. I mean the zlevel section.
    It has something to do with layering. If two different materials are placed next to each other, the "zlevel" will determine which material is overlapping the other. As Example:

    Cobblestone - "zlevel" : 1640
    Darkwood - "zlevel" : 2830
    Bricks - "zlevel" : 2860

    So if you place Cobblestone, Darkwood and Bricks next to each other, the Darkwood would overlap the Cobblestone at the connection border. And Bricks would do the same with the Darkwood and Cobblestone. This behavior could be usefull if you create a set of new materials.
    But if two materials have the same "zlevel" and are placed next to each other, one of it will overlap the other at the connection border. I have no clue how or why this happens. Maybe it has something to do with the "materialid" but I can only guess.

    If someone knows more about it, please let me know. Also let me know if I am wrong with my thoughts about the "zlevel". I just startet to learn about modding Starbound. Have a nice Day and

    Joy and Happiness
    Panthera Pardus
     
  14. The | Suit

    The | Suit Agent S. Forum Moderator

    No that is about right, it used to be worse before where the modID was the one which determined its zLevel - but now there is a separate factor for it.
     
  15. lazarus78

    lazarus78 The Waste of Time

    I use zlevel to some effect.

    [​IMG]

    It makes it look like the colored blocks are embedded into the wall and the black support beams are overlapping.
     
  16. Panthera Pardus

    Panthera Pardus Subatomic Cosmonaut

    Hello Again,

    that are nice Materials, and they show the "zlevel" behavior very good.

    Here is a Picture I made to show what happens when two Materials have the same "zlevel"

    Identical-zlevel.png

    The two Materials around the Windows have the same "zlevel". The right Material is just a flipped Version of the other. In the lower Part of the Picture, you can see the stupid (at least in this case) border.
    In the upper Part you can see the current look of these two Materials. I simply deleted the Borders in the Materials PNG-Files. Which could be alot of work. Why? As Example, the windows are made out of 9 different Materials. Center, Top, Bottom, Left, Right, and 4 different Corners. + 4 Inside Corners that are not on the Picture. ( Note: I tried the heavypipe.png together with the pipetemplate.config, but that didn't worked. No inside Corners)
    If someone knows a better way to get rid of the Borders, without deleting them on the PNG-Files let me know. Have a nice Day and

    Joy and Happiness
    Panthera Pardus
     
  17. Greenfinger Abibi

    Greenfinger Abibi Void-Bound Voyager

    Sooo, can someone please explain to me what is wrong with these blocks. Thanks!
     

    Attached Files:

  18. lazarus78

    lazarus78 The Waste of Time

    Well, they don't look quite right.



    We kinda need to see the code and what you expect them to actually look like. Saying "Look at this and tell me what is wrong" is not helpful at all.
     
  19. slowcold

    slowcold Scruffy Nerf-Herder

    Bumping an old thread to ask if it is still correct. It seems to be - I've been comparing the instructions with Sayter's excellent work - but I've already shown as less than competent at code punctuation!

    PS - thanks for whoever it was suggested Notepad++. I can see!!!! :nod:
     
  20. slowcold

    slowcold Scruffy Nerf-Herder

    Well. The instructions work - I've made 4 materials and they spawn nicely (look like hell though with placehlder graphics!)

    Edit: scratch last bit. Just retried and itemTag now causes no problems.
    I dislike computers at times. :)

    Problem: when you mine them, they get put in the main inventory bag, not the crafting materials bag, and I'm a tad confused on that.

    The item file I have:

    {
    "itemName" : "emerald",
    "rarity" : "Rare",
    "price" : 200,
    "category" : "craftingMaterial",
    "inventoryIcon" : "emerald.png",
    "description" : "A flawless emerald",
    "shortdescription" : "Emerald",
    "learnBlueprintsOnPickup" :[ "greenlasercore" ]
    }

    That's the one that works. I've looked at other mods (elithian mod and FU) and they have an additional line in items, which would make it:

    {
    "itemName" : "emerald",
    "rarity" : "Rare",
    "price" : 200,
    "category" : "craftingMaterial",
    "inventoryIcon" : "emerald.png",
    "description" : "A flawless emerald",
    "shortdescription" : "Emerald",
    "learnBlueprintsOnPickup" :[ "greenlasercore" ],
    "itemTags" : [ "reagent" ]
    }


    However, when I include that line, the game won't load. I get a JSON exception - cannot convert to string - and the game crashes. I'm missing something - probably something obvious.
     
    Last edited: Sep 8, 2017

Share This Page