For all Unity developers and developers-to-be, both beginners and professionals!
In this tutorial we'll run through the basics of how to set up a mod and get it to load in the Editor.
Posted by Kelso on Apr 10th, 2012
Basic Client Side Coding.
In this tutorial we'll run through the basics of how to set up a mod and get it to load in the Editor. Once the proper folder structure is in place and we tell our config file where to look we'll take a stab at creating a new terrain option for maps. Onward!
First things first - navigate to the folder you installed Fractured State to. At the time of this writing Fractured State doesn't actually install - it's just a .zip file that you unpack to a destination of your choosing (but I'm sure that will totally change in the future...totally). The first step is to determine the location of your Root Folder. On Windows this is <location of fs.exe>/fs_Data/fsdata/ and on Mac it's <location of fs.app>/Contents/fsdata. Open this folder and then edit Config.xml in your favorite text editor (I prefer Dreamweaver for XML myself, but to each their own).
You'll see something like this
A few things here. <debugLevel /> controls the messages you see during startup of the app. verbose means you'll get messages when stuff loads and a general update on progress. Setting this to none or omitting the element entirely will suppress these messages. If something tanks you'll always see the exceptions and stack traces regardless of these settings (unless something really tanks in which case you should report a bug in the forum). The next element controls where Fractured State should try to load Mod data from. The isRelative property determines whether or not the given path is relative to the game's executable or not. If you wanted to designate a fully qualifier path (on your Desktop or a separate HDD for instance) you would set this to false and then provide the full path as the value of .
Let's add a third element to this. Add the following XML below the element.
This will tell Fractured State that it needs to look for a mod called My Awesome Mod when it loads. So let's give it something to load. In Windows Explorer or Finder navigate to the folder you declared as the dataPath (this is fsdata/Mod by default). Create a new folder named My Awesome Mod and then inside this new folder create a file called Mod.xml.
Fill up Mod.xml with the following markup
I painted some texture and sculpted a quick hill just for flavor. Your view will be much more boring. Note that the value in <activeMod /> controls the name of the folder to look in, whereas the value of <name /> in Mod.xml controls the value that appears in the Editor. (Eventually this will totally be expanded to include version numbers and other stuff...totally.)
Now - let's actually mod something. Create a new folder in My Awesome Mod called Art. Inside this folder create a new file called Terrain.xml. Let's put the following markup in this file
Save this file and fire up the Editor again. In the New Map window you should now see a new terrain option called Test Mod Grass. Because this uses the same settings as the default grass terrain option you won't see any difference if you actually generate a map with this terrain.
Congratulations - you made your first (totally awesome) mod for Fractured State! The next step is to take a look at the SampleGrass material file and create a new one based on that. Terrains are loaded cumulatively so anything you add as part of your mod will be loaded on top of the base terrains. If you name a terrain the same as a base one, your modded one will win and overwrite the base one.