• Register
Post tutorial Report RSS How to set up a mod

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 on - 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

<?xml version="1.0" encoding="UTF-8"?>
<configData>
	<debugLevel>verbose</debugLevel>
	<dataPath isRelative="true">/fsdata/Mod</dataPath>
</configData>

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.

<activeMod>My Awesome Mod</activeMod>

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

<?xml version="1.0" encoding="UTF-8"?>
<mod>
	<name>My Awesome Mod</name>
</mod>

Save this file and launch the Editor. Once the loading procedure completes you'll see a message in the lower left corner of the screen indicating that My Awesome Mod is currently active.
Mod indicator

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

<?xml version="1.0" encoding="utf-8"?>
<terrains>
	<terrain name="Test Mod Grass">
		<size>512</size>
		<tileSize>256</tileSize>
		<material>SampleGrass</material>
	</terrain>
</terrains>

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.

Have fun!

Post comment Comments
matfrem
matfrem - - 26 comments

Just one question :
Your game is not even released, not even alpha, not even playable that you already have a mod system ?
Well.. do you expect people to use it NOW ?

Reply Good karma Bad karma+1 vote
Kelso Author
Kelso - - 50 comments

Of course. The game uses the same system as the mods for loading data so I have to develop the system in order to develop the game.

There's nothing stopping you from using it now. It wouldn't be very interesting because of the lack of features, but it's there to tinker with. :)

Reply Good karma+1 vote
matfrem
matfrem - - 26 comments

Nice ! Sorry maybe I was a bit rude, but I've seen many games begin with "oh, you can dome plugins", and wasting time opening their tech instead of making the game...
Good to see you still have your objectives, so good luck !

Reply Good karma Bad karma+1 vote
Kelso Author
Kelso - - 50 comments

No worries - I can see how it would appear odd. In reality, Fractured State is just a mod built using the framework.

Thanks for the interest!

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: