Patron Wiki
Advertisement
ModdingFundamentals.jpg

The best time to go through this article is before working on any mod. It's important to understand how Patron handles mods, especially in situations where many mods from different creators are used at the same time. And this last noted bit is the key: handling mods from different creators that modify the same aspects of the game. That topic is covered more in the Database tables articles, though so let's start at the beginning: one mod, made by yourself.

What do I need?[]

A whole lot can be modified or added to Patron, so answering this question is very difficult. It really depends on what you plan on modifying. Let's have a look at a few examples:

  • Events - Notepad++
  • Texts - Notepad++
  • Art (banners, icons, UI...) - Photoshop or similar 2D-focused software and Notepad++
  • Models (buildings, human models...) - Blender or similar 3D-focused software and Notepad++

You likely noticed the same application is mentioned in all the examples. That's because importing and using almost anything in Patron, eventually leads to editing game files (database tables, definition files...). This can be done with the basic Windows Notepad (any simple text editor will do actually), but we advise using Notepad++.

Create the mod folder[]

Changing or adding files directly to the InstallationFolder\Data folder is really not advised. The game expects mods to be in the InstallationFolder\Mods folder and you should do it like that. Separating a mod from the default game early on will be beneficial later on.

So, when you've decided on the name of your modding masterpiece, navigate to the InstallationFolder\Mods folder and create the folder for your mod. Let's call it NewMod for this tutorial's sake. Now that we have the Mods\NewMod folder, imagine this folder as the InstallationFolder. This is what a comparison would look like: InstallationFolder\Data is virtually identical to InstallationFolder\Mods\NewMod\Data. The game will treat it like that, so it's best if you do it too.

You might ask OK. Interesting. But why is that important?. This is the thing: the mod's folder structure should mimic that of the default game. This is by far the best possible practice, just in case some things are expected by the game to be in certain sub-folders. Let's take any database table as an example. The game knows it can find the Buildings.wdt in the Data\Base folder. If you want the game to use a different database table, you have to mimic that by creating Buildings.wdt in the Mods\NewMod\Data\Base folder.

Make the modifications[]

This section will be short, because this can encompass a massive amount of widely different topics. Search for more specific tutorials or contact us directly if you have questions regarding modding something specific.

For the sake of this tutorial, let's imagine we've added a new building called Watchtower (how creative...). This would require a new folder containing the building in Mods\NewMod\Data\Models\Buildings and a new entry in the Mods\NewMod\Data\Base\Buildings.wdt database table.

A good practice is to automatically create the Data folder inside your mod folder (Mods\NewMod\Data). You'll need it anyway, so you might as well do it right away.

Editing databases and the principles of dynamic databases are explained in another tutorial and please do take the time to read and understand it. It's crucial for making mods work properly with one-another and with the game.

Package the mod[]

So we've got the modded files and everything. Now what? Now is the time to package it all up into a nice little single archive that can be easily shared.

The packaging is done through the Mod Manager located in the Installation Folder , but there is one more file you need to create for the packer to know what to do.

The mod definition file, .sgwm. For now, you'll need to create this file manually (Notepad++)... and note the extension!

The mod definition file MUST be placed in the InstallationFolder\Mods folder and nowhere else, otherwise the game won't register the mod.

Here's an overview of a few things to be mindful of when creating the definition file:

  1. Make sure the name of your mod in the definition file matches the name of the mod folder AND the name of the definition file (.sgwm)
  2. Make sure you have no empty spaces in the Name parameter. Don't name your mod New Mod. Name it NewMod or New_Mod. NO EMPTY SPACES!.
  3. Use tab to separate parameter names from their corresponding values
txt
Version: 1000
Mod:
{
 Name: NewMod
 Author: My_glorious_name
 Description: New_mod_is_the_best_mod_in_the_galaxy!
 Picture: Mods\NewMod\NewMod.jpg
}

The purpose of Name, Author and Description should be self-evident (just be careful with the empty spaces and the tabs separating the parameter name from its value!), but what about the Picture? That is used by the Mod Manager. Once again, it is advisable to simply duplicate the template image and use that to determine the correct size. The picture size we recommend to get the best outcome is 1280x720 px, .jpg format. Although any ratio will work, the default is 16:9.

This image is also used on Steam Workshop, if you decide to publish the mod there. A template definition file and mod folder is supplied with the game by default. Duplicating that as the starting point for a new mod is advised.

Package the mod - Mod Manager[]

Great! That is set, so let's move onto the packaging itself.

  1. Start the Mod Manager
  2. Click the Select mod button to choose what mod you'll manage (edit)
  3. Select either the mod definition file (.sgwm) or the mod archive (.sgwma) to select the mod for packing. If there is no archive yet, you can only select the definition file. In that case, the Mod Manager will automatically create the archive right beside the definition file.

You'll usually be creating a new archive, meaning you'll likely select the .sgwm file, but in case you just want to do some other action through the Mod Manager (like unpack a mod archive you took from your friend) then you'll select the archive file (.sgwma). Unpacking mods is also done automatically by the Game Launcher when you set a packed-up mod as active.

That .sgwma file is the complete mod, rounded up into a nice single-file package, together with the mod picture and the definition file. The game uses the unpacked version of the mod, but sharing a single file is simply easier.

Time to share[]

Now that you've got your mod all packed as .sgwma and ready to go, the method of sharing is basically on you. We place no restrictions on this. The Mod Manager can share the mod directly onto Steam Workshop, but you can just as easily take the NewMod.sgwma to your friend on a USB stick, or upload it to some other repository.

To use the mod, copy the NewMod.sgwma into the Mods folder. If you've subscribed to a mod through Steam, then the mod will get copied into the Mods folder automatically the next time the Game Launcher is started.

Use the GameLauncher -> Mods window to set the desired mods as active (the checkbox on the left of the mod name in the list).

When a mod is set to active, the launcher unpacks it so it's ready for use in-game (if it wasn't unpacked already). To deactivate a mod, simply toggle the active flag off. Deactivating a mod does NOT delete the unpacked mod folder!

Final thoughts[]

Creating mods can be daunting, but we encourage you to try. Start with something small, simple, maybe change some text and see how things work how they fit together. If you're serious about modding, please read the Database tables article. It is vital to understand how these work.

Advertisement