Tutorial Getting started in making mods for Starbound

Discussion in 'Starbound Modding' started by Thundercraft, Aug 11, 2016.

  1. Thundercraft

    Thundercraft Phantasmal Quasar

    I've noticed that some players are asking how to get started in making mods. Sometimes they ask in inappropriate places, such as in a mod's discussion area. Rather than ignore them completely, I'm tempted to give them a link to a thread with tips and links to get them started. I think mod making should be encouraged.

    To this end, I looked for a good thread on getting started in mod making. There is the Notice - MODDING GUIDES pinned thread, but it seems a bit dated and is missing some newer, useful stuff. There's also agmoyer's Guide to Basic Mod Making for 1.0, which is nice. I did not find much else that's current, so I'm starting a thread.

    Anyway, here's my list so far:

    1. Download this: Unofficial Modding Ebook 2.0. It covers most of what you need to know.
    2. Install Notepad++.
    3. (Optional) Install WinMerge. I often use it to compare "vanilla" (original) Starbound /assets/ with nearly identical files in a mod, to see exactly what a mod author changed. This is also useful to compare an older version of a mod with a new version, or to compare the files of two similar mods. Experienced coders can use it to update their mods by applying changes to files or merge entire files or even folders.
    4. Important links:
    5. Possibly useful links:
    6. Unpack Starbound's assets.pak
    7. Important! Move the new unpacked folder outside of Starbound. It will give Starbound errors, otherwise.
    8. Ask questions:
    9. Examine the contents of unpacked assets. Windows' File Explorer and Windows' search function are your friends! (Myself, I prefer using Super Finder to Windows' search.)

    To extrapolate on that last point:
    Search and study the contents of \assets\, examine how other mods do things that are similar to what you want to do, read the forums, experiment, and ask for help when needed. This is how I learned Starbound modding when I was creating my own unique crop.

    Here are a few tips and examples to get you started:
    Look in \assets\objects\farmables\ and study vanilla files. Perhaps, say, make a copy of \corn\ or \currentcorn\, put it in \mods\{my_mod_name}\objects\farmables\. Rename everything about your new crop - the folder and every file and the "objectName" inside the .object - to (for example) "aliencornseed", to make it different so players can still grow vanilla corn. Make a few changes to your crop and test. For testing, you can type "/admin" and then "/spawnitem aliencornseed" (or whatever you used for "objectName").

    Myself, I avoid mods that require players to spawn them with /spawnitem. I want to earn stuff without cheating and I want the experience to be a bit more thoughtful and immersive. You could (1) make your stuff purchasable from a merchant, (2) make it find-able as monster drops, random loot or a reward for some quest or something, or (3) you could make it craftable (or any combination of these, even all three). For the "aliencornseed" example, you would likely want to either add the seeds for sale at Terramart using a .patch, add them to the treasure pools (drops or rewards) using .patch for one or more of the files in \assets\assets\treasure\, or make them craftable at a crafting station.

    You don't know how to add them to Terramart? Normally, I'd suggest you use Windows' search to search your unpacked \assets\ folder for any files or folders with "terramart" in the name. (Even better, try searching all files in your assets folder for any that contain the word "terramart".) But, in this case, I'll help you out:

    To add an item to Terramart you create a "terramart.object.patch" file in Notepad++ and put it in \mods\{my_mod_name}\outpost\terramart\. Example:
    Code:
    [
      {"op":  "add", "path": "/interactData/items/-", "value": {"item": {"name": "aliencornseed"}}}
    ]
    The price will be based on the "price" set in your aliencornseed.object.

    To make something craftable, you will need to create your own .recipe file and put it in \mods\{my_mod_name}\recipes\{name of crafting table}\. Since this is a seed, the Foraging Table may be appropriate. If you wanted to, say, add it to the farming tab, look at examples in \assets\recipes\farmtable1\farming\. Look at hoe.recipe to see how this is done and make your own version, calling it "aliencornseed.recipe" or something. To make sure it appears in the farming tab of the Foraging Table, be sure that it has "craftingfarm" and "farming" as part of "groups".

    You could create your own. Study related folders like \assets\interface\crafting\, \assets\objects\crafting\, and the \assets\scripts\ the crafting table uses. Or study other mods to see how they did it. Alternatively, you could add support for or even require players to use The Tabula Rasa mod as their crafting station.
     
  2. Thundercraft

    Thundercraft Phantasmal Quasar

    Useful tips:
    • At the least, make a backup of {Steam location}\steamapps\common\Starbound\storage. This way, if the worst happens and a bugged mod breaks your character or universe (such as making it impossible to visit the Outpost), you can fix it. Actually, unless it is incredibly simple (like an edit of a vanilla image), it's best to test your own mods with a new character, or even a separate copy of Starbound.
    • If you run starbound.exe directly from /win32/ or /win64/ (such as from a copied Starbound folder, just to test your mod), it will not load workshop mods correctly. So, you need to move the workshop .pak file(s) to your /mods/ folder. (See below...)
    • Steam workshop mods can be found inside {Steam location}\steamapps\workshop\content\211820\. Each subfolder is named based on the Steam id for the mod. Almost without exception, each mod is named "contents.pak". This makes it very difficult to find the mod you are searching for. You just need to know the Steam id. (For example, to find which \workshop\ folder contains the Holographic Dancers mod you no doubt subscribed to, search for the "733978084" portion from the ?id=733978084 end of Steam's mod page URL or link.)
    • Starbound's priority in loading assets and mods is /assets/ < /mods/ < Workshop < /user/. Starbound loads /assets/ first, then /mods/, then workshop mods - the later stuff taking priority. So, say, a Workshop mod that replaced a Terramart file would take priority over a /mods/ mod which tried to do something similar.
    • If you want to load a Workshop mod in your /mods/ folder (for example, to change the load priority or to install it on a server to allow it to work correctly in multiplayer), you can either rename the contents.pak and move them there or unpack and put the contents in a new, appropriately-named subfolder in /mods/. Just be sure to remember to Unsubscribe from the workshop version.
    • Examine your starbound.log file (in {Steam location}\steamapps\common\Starbound\storage) frequently. If you are having a new issue, your .log will likely contain a new "Error" or "Exception" about it. Definitely, you will want to iron out any errors or other bugs before your release. If you can't decipher what your .log means, you could politely ask for help on the ##starbound-modding IRC. If someone offers to help, you can share your starbound.log via a Pastebin link.
    • If you ask for help on ##starbound-modding, Pastebin will be your friend for sharing code. Myself, I try to remember to select something other than "Never" for Paste Expiration and - unless it's a starbound.log or a .LUA script - select JSON for Syntax Highlighting.
    • Debugging your mod is easier when you only have one mod installed. Trying to debug your own mod with dozens of others installed can be difficult because (a) it's possible for a mod to conflict with yours, (b) other mods may being generating errors (even if they seem to function okay), and (c) the .log does not always indicate which mod or which file is the culprit. This is another reason to create your own mods on a separate copy of Starbound.
    • Mod repository mods are installed in {Steam location}\steamapps\common\Starbound\mods. These can be either in a .pak format or unzipped as a separate folder.
    • When creating your own mod, you will want to keep it unpacked in a folder in /mods/ to make it easy to make changes as you test in-game. Call the folder whatever you like. When you are ready to release, though, you might want to .pak it or follow the guide to upload to the workshop.
    • Some mod authors prefer to release on Steam workshop, while some do not. Some prefer to release on the official mod repository, while some have never used it. And some release on both. Each has advantages and disadvantages. Workshop versions seem more popular now than their repository counterparts. They're a snap to install and uninstall. And Steam automatically updates players as mods are updated. But installing in /mods/ may give better multiplayer compatibility. Occasionally, one has to restart a couple time for a newly subscribed workshop mod to be recognized. And some mod authors do not like how workshop forces updates on players:
     
    Last edited: Aug 11, 2016
    Hekkaryk and Shadox2.0 like this.
  3. Shadox2.0

    Shadox2.0 Spaceman Spiff

    Thx for this tutorial , but do you know how to update a mod on steam workshop please (as creator) , i've read somewhere we only need to use the tool again but it add a second mod to my list instead of overwrite the first :x

    Thx if you know how too , and if not thx anyways xD

    Nvm i think i've found , my issue was my fault cuz i've make a new folder for the 1.1 instead of replace the mod in the 1.0 folder.
     
    Last edited: Aug 24, 2016
  4. Thundercraft

    Thundercraft Phantasmal Quasar

    I sort of did update my mod. (My Minor Fossil Game Tweak.) But, really, all I did was change the Preview Image.

    Yes, it seems we only need to use the Steam Mod Uploader tool to update our mods. Perhaps you made a mistake to cause it to create a new mod? Did you hit the [Reset Steam Mod Information] button by mistake? Did you alter your _metadata file or move your mod's location? Perhaps you changed your mod's folder name?

    What I did was follow one of the "How to upload to Steam Workshop" tutorials in my OP. I created a /mymods/ folder in my Starbound directory and moved my mod folder there.

    After I uploading to the Workshop, I was careful not to move the location of my mod (just in case that might confuse Steam). Before I updated my mod (to change the Preview Image), I manually looked at the _metadata file with Notepad++, to make sure that Steam added the "link" and "steamContentId" fields. If those are missing, then if you try to re-upload your mod, Steam will create a new mod instead of try to update your existing mod.

    I know this because that's how I created Fossil Game Tools +2 - by intentionally creating a derivative of my Minor Fossil Game Tweak. To do that, I created a copy of my mod folder inside /mymods/ and changed a couple lines of code in one file. Then, in _metadata, I changed the "name", "friendlyName" and "version" fields, and finally deleted both the "link" and "steamContentId" fields. The Steam Mod Uploader tool must create a unique steamContentId and link for each mod. So, if you delete those fields, it knows to create a new mod.
     
    Last edited: Aug 24, 2016
  5. Shadox2.0

    Shadox2.0 Spaceman Spiff

    No dont worry its ok , i didnt hit the reset button.

    When posting it the first time i've create a 1.0folder , and for try update i've make a 1.1folder , so for steam it was anothers , so i've replace files in 1.0folder with file in 1.1folder and its ok now and look good i think :p

    And aboput the metadata file i didnt change anything befire posting the first version and even the update it seem work well so i must be lucky x)
     
  6. Thundercraft

    Thundercraft Phantasmal Quasar

    That confirms it, then: Changing your mod's folder name is why Workshop created a new mod. This must confuse the Steam Mod Uploader tool.
     
    Shadox2.0 likes this.
  7. jo1152

    jo1152 Space Spelunker

    Hi is there a place i can suggest for new mods to be made? i am 10 years old and i don't know how to do modding without messing up really bad.
     
  8. Thundercraft

    Thundercraft Phantasmal Quasar

    (1) If you can follow a tutorial, you may be able to create a simple mod. Myself, I find modding can boil down to trial and error.

    (2) As long as you make a backup of your game universe ( {Steam location}\steamapps\common\Starbound\storage ) or mod in a separate copy of Starbound, you should be fine. Worst case scenario, you'd restore your universe from your copy and/or remove the mod you were trying to create.

    Anyway, messing up that bad is unlikely. I have yet to mess up so bad that I had to restore.

    (3) If it's hopeless or you don't want to try, you could post mod suggestions in Steam's Starbound Workshop discussion area, here:
    http://steamcommunity.com/workshop/discussions/?appid=211820

    However, there are tons of mod suggestions and not nearly enough people capable or interested in making them. Most modders work on their own ideas, instead. There's no end of ideas, so it's incredibly unlikely that you'd get someone to make your mods.
     
  9. Dankmods420

    Dankmods420 Big Damn Hero

    How would you go about making a unique crop drop unique things? like making a blackberry bush, flax, beans, etc. drop their respective fruits/vegs?
     
  10. projectmayhem

    projectmayhem Spaceman Spiff

    Best thing to do, is go into your assets and look at how the vanilla crops do it. Then you mimic the files with your own crops. Some files will need patched, like whatever treasurepool file has the crop drops located in it.
     

Share This Page