Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: State of Decay Beginner Modding Guide (PC version)  (Read 25026 times)

0 Members and 1 Guest are viewing this topic.

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
State of Decay Beginner Modding Guide (PC version)
« on: December 23, 2013, 07:13:26 AM »
STATE OF DECAY Basic Modding Tutorial
by: BIZ


Disclaimer: This tutorial is for the PC version of the game only. If you have the game on XBOX you can NOT use this tutorial. It wont work.

With that out of the way lets get started. This tutorial is meant to familiarize you with the basics of modding the game's core files. In this tutorial guide, we will extract a .xml file from the games archives, edit the name of the main character, compile the edited .xml file into .bmd format for use in the game, and then install our modded content. Each task will be broken down into its own section:

I - Modding overview
II - Tools Required
III - Asset Extraction
IV - XML and BMD
V - Editing an XML file
VI - Compiling XML to BMD
VII - Installing our mod


I - Modding Overview


While the devs at Undead Labs do not officially support modding the game, they were kind enough not to make it a real pain in the ass to do modding. Before you begin here are some other sites that are filled with valuable info:

https://forums.undeadlabs.com/forums/pc-mods.17/
http://steamcommunity.com/groups/stateofdecaymodding/discussions

Ok to the point, State of Decay has a lot of great options for modders with very basic skills and really all you need is some time and a text editor. Before we crack into the tools and files and things like that here is the general idea of how modding works.

Inside of the game directory on your PC, you will find a folder named 'Game' containing several .pak files (ex: gamedata.pak; levels.pak; characters.pak). These .pak files are like big zip archives that contain all of the files required by the game. When the game needs to load a setting, level, or item, it reads inside the .pak files.

However the game also checks for any files in the game directory itself and will load them instead of the .pak equivalent. This makes modding the game rather simple, as long as we keep file structures intact, the process is as simple as extracting an asset from the large .pak files, making our changes, and then dropping it in the State of Decay game directory. Got it?

Once again this is the modding process:
1. Extract asset from .pak file
2. Edit asset
3. Place edited asset in State of Decay directory, preserving file structure.

It is also important to note that some changes require you to start a new game before they will take effect.
« Last Edit: December 31, 2013, 03:32:06 PM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #1 on: December 24, 2013, 09:05:57 PM »
II - Tools Required

Before we go any deeper here are three essential tools (as of this writing) that you will need to do simple modding for State of Decay.

Extraction Tool - Used to extract assets from .pak files, essential for modding.
 * Quick BMS GUI - Nice GUI, easy to use and install. Support topic.
 * SoDET - SoD Extraction Tools, no frills, lightweight, no install. Support topic.

Text Editor - For editing files, you can use notepad, but i recommend:
 * Notepad++ - its awesome, try it.

XML Compiler - Use this to compile XML into .bmd format for use with the game engine.
 * xml2bmd - this is it, lightweight, and real easy to use. Support topic.

Download these and have them ready as we will use them in the next section of our tutorial.
« Last Edit: January 04, 2014, 06:59:48 AM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #2 on: December 24, 2013, 09:06:24 PM »
III - Asset Extraction

In this section we will be extracting a .xml file from one of the paks. I will be using Quick BMS GUI for this tutorial but the same principles can be applied to SoDET as well if you prefer.

1.) Open Quick BMS GUI (or your preffered extraction tool).

2.) First we need to define a Script File for QBMSG to use. This is like a key that is used to open up the archive. State of Decay .pak files use the script zip2.bms. If you don' have it, you can download it here:
zip2.bms (2.73 Kb).

2a.) In the top graphical menu go to 'Script File -> Open..' and click. Navigate to where zip2.bms is stored and select it for use. Once selected it should show up in green like this:



3.) Next we need to select a .pak archive to extract files from. The .pak files should be located in the 'Game' folder inside the directory where you installed State of Decay. The Steam default directory is:
C:\Program Files (x86)\Steam\SteamApps\common\State of Decay

For the purpose of this guide we will be extracting the archive gamedata.pak

3a.) In the top graphical menu go to 'Archive File -> Open Archive' and click. Navigate to your SoD installation directory, then click the 'Game' folder, then select gamedata.pak. Once selected it should also appear in the main area like this:



4.) Lastly we need to create or choose a folder where our extracted assets will be dumped by QBMSG. You can select anywhere you want, I would recommend that you use a different directory then the one where you installed SoD (to avoid confusion and contamination).

From the top graphical menu go to 'Folders -> Select Output Folders' and click. Choose a directory where you want the extracted files to be dumped and your selection will now appear in the middle as well:



5.) Finally hit the 'Extract' button and QBMSG will now extract all the contents of gamedata.pak!



« Last Edit: December 31, 2013, 03:33:15 PM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #3 on: December 24, 2013, 09:41:19 PM »
IV - XML and BMD

Ok in this quick section we are going to look at the file we will be editing and quickly touch on the two main formats used with this game. In the last section we had extracted the contents of our gamedata.pak file, so lets navigate to the directory where we dumped those.

Once you are in the output folder, navigate to the directory .../libs/class3/rts/. The file we are looking for here is characters.xml and it should be near the top. You should notice that there are two files with that name but each has a different extension; characters.xml and characters.win.bmd.



So whats the deal? Whats the difference? Well let me explain:

XML - You can open these files in a text editor and edit them. They usually contain data about key functions of the game. They are not (usually) read by the game. They are like the source files for SoD. They can be compiled into BMD format.

BMD - These are encrypted files. You can't edit these in a text editor. The game reads these files and uses data from them. They are compiled from XML files.

So basically the way it works is that .xml files are source files that we can edit, then we compile them into .bmd files, which are used by the game. Now there are some exceptions to the rules, and the game does actually read/use a few .xml files without BMD counterparts. For the most part though, whenever you see a .xml file with a .bmd counterpart, you can assume that its a source file/game file thing.
« Last Edit: December 27, 2013, 06:02:56 AM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #4 on: December 24, 2013, 09:43:47 PM »
V - Editing the XML file

Ok now we are going to open up and make a simple edit to our .xml file. In this section we will be changing the name of the starting character Marcus Campbell. Now this is a really big file (over 4500+ lines) so it may look overwhelming. As with most modding, you will need to spend lots of time looking at and reading things so prepare yourself.

1.) Navigate to the directory where you dumped the contents of gamedata.pak. Find the file characters.xml and open it in your text editor of choice.

2.) First thing we need to do is locate our character. The easiest way of doing things in this instance is to just search for the characters name, 'Marcus'. The first result will appear on Line 21:
Code: [Select]
<Character HairColor="Base" HairType="Bald" HeadType="Marcus" Model="characters/male/human/story_characters/marcus_campbell.cdf" SkinColor="Base" VoicePitch="Normal" VoiceRole="HRO" PortraitHairColor="1" PortraitHairType="1" PortraitHeadType="13" PortraitSkinColor="1">
It should be noted that this method does not always yield the best results as the word 'Marcus' appears another 61 times in this .xml file. Luckily for us in this case, the first result is the one we want. So now lets look at the whole <Character> block starting on Line 21:
Code: [Select]
<Character HairColor="Base" HairType="Bald" HeadType="Marcus" Model="characters/male/human/story_characters/marcus_campbell.cdf" SkinColor="Base" VoicePitch="Normal" VoiceRole="HRO" PortraitHairColor="1" PortraitHairType="1" PortraitHeadType="13" PortraitSkinColor="1">
    <DescriptionText Flags="" Notes="Character Bio" Text="Just came to Trumbull Valley for a vacation." />
    <NameText Flags="Do Not Localize" Notes="" Text="0 STORY Marcus Campbell" />
    <Names>
      <FirstNames>
        <NameText Flags="" Notes="" Text="Marcus" />
      </FirstNames>
      <LastNames>
        <NameText Flags="" Notes="" Text="Campbell" />
      </LastNames>
    </Names>
    <Traits>
      <TraitBlock>
        <DefaultTrait Trait="Trait.Voice.HRO" />
        <DefaultTrait Trait="Trait.Story.StarterMale" />
        <DefaultTrait Trait="Trait.Immune.NonStoryContent" />
        <DefaultTrait Trait="Trait.Personality.Realist_Charismatic" />
        <DefaultTrait Trait="Trait.Mood.Confident_Assertive" />
        <DefaultTrait Trait="Trait.Job.Clerk" />
        <DefaultTrait Trait="Trait.Hobby.Hiking" />
        <DefaultTrait Trait="Trait.Talent.Tough" />
        <DefaultTrait Trait="Trait.Talent.Strong" />
      </TraitBlock>
    </Traits>
    <Inventory>
      <Backpack Name="BackpackSmall01_v01" />
      <Consumable Amount="1" Name="Food" />
      <Consumable Amount="1" Name="HealthPack" />
    </Inventory>
  </Character>

3.) After looking this over you should find most of it pretty self-explanatory. We can very clearly see a section for first names starting on on Line 25:
Code: [Select]
<FirstNames>
        <NameText Flags="" Notes="" Text="Marcus" />
      </FirstNames>

and also a section for last names starting on Line 28:
Code: [Select]
<LastNames>
        <NameText Flags="" Notes="" Text="Campbell" />
      </LastNames>

4.) Now lets edit our characters name to Tyrone Biggums. You will need to make edits to Lines 26 & 29. Your changes should look like this:
Code: [Select]
<FirstNames>
        <NameText Flags="" Notes="" Text="Tyrone" />
      </FirstNames>
      <LastNames>
        <NameText Flags="" Notes="" Text="Biggums" />
      </LastNames>

5.) Now save the file and you are done. congratulations, you have just changed the main characters name! In the next section we will compile our newly edited file into .bmd format so the game can use it.
« Last Edit: December 27, 2013, 06:26:23 AM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #5 on: December 24, 2013, 09:47:25 PM »
VI - Compiling XML to BMD

This is the part where everything gets crazy! I'm going to move fast so make sure to read CAREFULLY!

1.) Select your freshly edited characters.xml file



2.) Left click and drag it on TOP of the program xml2bmd.exe



3.) Wait.

4.) Wait.

5.) And you should now have a brand new file called characters.win.bmd!



« Last Edit: December 27, 2013, 06:38:58 AM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: State of Decay Beginner Modding Guide (PC version)
« Reply #6 on: December 24, 2013, 10:02:48 PM »
VII - Installing our mod

For the final part of the process we will be looking at how to install our brand new characters.win.bmd file and how to preserve file structure. This is important to understand or else none of your mods will work.

First of all before anything, lets open up the folder where we extracted all the assets from gamedata.pak and look at the folders. There should be a list like this:
Code: [Select]
-entities
-fonts
-languages
-libs
-scripts

As you can see, all the files inside gamedata.pak are organized into very specific directories. For our mods to work we need to recreate those directories in our State of Decay installation folder. We MUST maintain the folder hierarchy or else our mod will not be loaded.

For example: When the game wants to load the file characters.xml, it will look for it inside gamedata.pak in this location:
../libs/class3/rts/

This means that we can override the default characters.xml file if we put an edited version at the same path inside our State of Decay installation directory, like so:
.../State of Decay/Game/libs/class3/rts/

If the modded file is not there, the game WILL NOT load it. It is not smart, and it will not search anywhere else for the file. So the moral of the story is maintain file structure!


Finally a few important points:

* The default installation directory for State of Decay is:
../Steam/steamapps/common/State of Decay


* The Game folder inside your installation is where you want to start building your file structure from!

-----

Tutorial time, step by step!

1.) Navigate to your State of Decay Installation directory. you should find a folder name Game, open it.

2.) Inside Game folder, look for a folder named libs and open it, if none exists create it.

3.) Inside libs folder, look for a folder named class3, if none exists create it.

4.) Inside class3 folder, look for a folder named rts, if none exists create it.

5.) Inside rts folder, copy your edited characters.xml file into this folder to install.

6.) Now test in game.

« Last Edit: January 02, 2014, 05:23:57 AM by BIZ »