Create a Simple Mod

You want to create a mod, but don't know where to start? Here's a guide to creating what's probably the simplest mod you can, a speed boost for when you are running. This mod will only work on single player and servers you host, so don't expect it to work on the official servers.

General
Before you even connect to a server, the game compares your local mod files with the mod files active on the server. If they're not the same, you won't be able to connect. This helps prevent the problems that other games have had with mismatching mod versions causing crashes. This also means you need to make sure you've got the same files at both ends if you want to connect.

Assumptions
This guide makes a number of assumptions. The first of these is that you can find your way around on the filesystem, and you know where files are installed. The second is that you're willing to put some time in to understand JSON. JSON is a relatively straightforward way of storing information in plain text, but for more complex mods you will need to understand how different files interact with each other. We'll start with an easy example however.

Getting yourself set up
While you don't need to have any fancy tools to create a mod, it does help to have some assistance. For working with the JSON files, the Atom editor is recommended as it can highlight some types of errors. This can save you hours of trying to work out why a mod doesn't work! For this guide, the expectation is that you'll be using Atom.

If you use the launcher:
You'll need to locate the "Mods" directory on your computer. By default, this will be under "C:\Games\CardLife\Mods".



If you use steam
Right click on "CardLife" in your library, select "Local Files" tab, and then click on "Browse Local Files".



This will open a file explorer window with game files. Navigate into the "Mods" directory



Creating a folder to keep your mod files together
Create yourself a folder to put your mod files into. This help to keep things neat, and makes it easier to select and manage mods in the long run. In this case, I'm going to call it "Speed Boost". Once you've created the folder, you should have something that looks a bit like the following.



Adding files to the mod
Rather than try to create the JSON files by scratch, we're going to copy an existing one from the "GameData" folder so that we can then modify it. There's a large number of files in the GameData folder, and it's worth only copying the ones that you need to alter. NEVER modify the files in the GameData folder itself, otherwise you won't be able to connect to anybody else's servers!



So, copy the CharacterMovement.json file, and paste it into your "Speed Boost" mod folder. You should end up with something like this:



Now we've got some files in place, we should open our editor, Atom. From the "File" menu, you want to "Open Folder", and navigate to your mod folder.



When you navigate to your folder, you'll find that Atom won't show you the files in it. That's ok, we're just choosing the right folder.



Once you've selected the folder, Atom will open new window showing you the files in your current project. At the moment, it's just the "CharacterMovement.json" file. If you click on the file on the left, the contents will be shown in the right hand pane.



You can probably already guess what needs to be altered to change the speed of your character's sprint. Click on the "3.5" after the "SprintSpeed": line, and change it to read "6.5" instead. Once you've finished, it should look like the following:



Once you've finished with your edits, you can click on File -> Save to save the file. A helpful hint - The blue circle to the right of the filename tab indicates that you've made modifications and not saved them yet.

Adding mod info
That is the mod part successfully done! However, it'd be a good idea to add some further information, so that people know who authored the mod and the mod's homepage. This lets other people download the mod, as they'll need it on their client too if they want to join a server with the mod active. With that in mind, click on File -> New File to create a new tab. You'll need to type something like the following in: { "author": "YOUR_NAME_HERE!", "link": "http//a.website.com/link" } The rest of the "author" line should have your name in it. The rest of the "link" line should have a link to a website where people can download your mod from. You should end up with something like the following, but with your details in:



Once you've done this, click on File -> Save. You'll be prompted for a filename, so call the file "info.txt". You can close Atom, as we've finished with it. Now you have a mod directory ready to distribute if you want to. The easiest way of doing that is to create a zip file by right-clicking on the "Speed Boost" folder and "Send To", and then "Compressed (zipped) folder". You'll then need to give the file a name.



You can then share this file with others. They will need to unzip the folder into their Mods directory too.

Using the mod
You can play with your mod in either Single player or MultiPlayer mode. You need to click on "Host/Single Player" in the CardLife main menu. You can then select single or multiplayer, and select the mods you want to use. Mods with white square box are selected, and you can choose the order that mods are applied.



Selecting a modded server
At the server select screen, you need to click the "Modded Servers" box in order to be able to see servers with mods. If you click on the text in the "Modded" column for a modded server, it'll open a window with information about the mods that the server requires. It'll also tell you if the mod is installed.



Gotchas
If you make ANY changes to your mod directory, including changing the "info.txt" file, then all players have to have the updated files.