Caves of Qud

Caves of Qud

30 ratings
Getting Started with Mods: Two Ctesiphus
By Robin
Want to expand your modding capabilities? You've got some experience, but wondering what else you can accomplish? Curious as how to add characters to the game, and give them custom sprites? Then this guide is for you!

With this guide we will go over, step-by-step, the process for building your own mod for Caves of Qud (again)!
3
   
Award
Favorite
Favorited
Unfavorite
Preamble
Hello!

In this step-by-step guide, will go through the process for duplicating characters, modifying sprites, and creating entirely new objects.

If this is your first time modding Caves of Qud then I recommend you read this guide first.

In this guide we will be go over the ways to modify the game in the following ways:
  • Creating a second Ctesiphus
  • Modify in-game sprites directly
  • Adding new characters and objects

There are two pieces of third-party software we'll be using throughout this guide.

The first is Visual Studio Code, which is a text editor which will let us more easily modify our game files. You can find a link to download Visual Studio Code here.[code.visualstudio.com]

The second is Paint .net, which is a handy image editing software which does a fantastic job in editing some sprites, which we'll be doing later on. You can find a link to download Paint .net here.[www.getpaint.net]

You'll also need to download the Tile Modding Toolkit, which is necessary for modifying in-game sprites and tiles. You can download the Toolkit here.[www.dropbox.com]
How To: Add Second Ctesiphus


As the title of this guide states, we are going to create two Ctesiphuses (Ctesiphi?).

To begin, open up the Caves of Qud folder. The address will be something like C:/steamapps/common/Caves of Qud, which can be easily found by right-clicking Caves of Qud in your Steam Library and selecting Properties.



Then selecting Local Files




And then selecting Brose Local Files...




Now you should see a folder containing a subfolder called CoQ_Data



Go into that folder, and then go into StreamingAssets



Then go into Base



Scroll down and find Joppa.rpm



For the following segments of this guide, all editing / modding will be done with Visual Studio Code, a free text editor available for Windows. You can find their website here.[code.visualstudio.com] Note, this software is not required for modifying the game files, it is simply the one we will be using for this process. If you have your own editing software you prefer to use, or Visual Studio Code is not available for you, then feel free to use whichever software you wish.

It is most likely the case that .rpm files are not linked to open with Visual Studio Code (or whichever text editing software you are using). If this is the case, then to set it up so it opens with Visual Studio Code, you'll first right-click on Joppa.rpm and scroll over to Open with...



Then, you'll find the location of Visual Stuido Code (search for it in wherever you have saved the application on your computer), select that software, and click OK



Now let's open up Joppa.rpm



This is Joppa. Doesn't look very familiar to be honest, but hey, this is what we got to work with.

We need to find Ctesiphus, so the easiest way to do this is to, well, Find "Ctesiphus".

Ctrl-F (or Command F) and enter "Ctesiphus" into the text field that pops up.



There's our good buddy Ctesiphus! Okay, next step is to head on over to your other Caves of Qud folder (found in C:/Users/Your_Name/AppData/LocalLow/Freehold Games/CavesofQud).

Once there, you'll enter the Mods folder



If this folder is not present, simply make a new folder and name it "Mods"

Once inside the Mods folder, let's create a new folder for our new mod



Enter the folder, right-click, scroll down, and create a new Text Document.



Now, open that file with Visual Studio Code.



This file is going to house the changes to Joppa.rpm. First, let's set up our necessary pieces of code.

<?xml version="1.0" encoding="utf-8"?> <Map Width="80" Height="25"> </Map>



Then, switch over to the Joppa.rpm file and copy-paste this bit of code into your new .rpm file



Then change the X coordinate from 41 to 42. This will create a duplicate of Ctesiphus at the coordinate point (42, 6), which will be right next to the old Ctesiphus. The code will look like this:



Now save this file as Joppa.rpm

It is necessary that you add the .rpm to the end of the file name, and have selected Save as type: All Files



Start up Caves of Qud, and you should see two Ctesiphuses sitting next to one another.

How To: Modify Sprites


So, we can duplicate objects, and we know how to modify the color of sprites, but what if we wanted to change what the sprite looked like?

To do that we're going to have to download the Tile Modding Toolkit, which can be found here.[www.dropbox.com]

We are also going to need an image editing software that supports alpha levels, or transparent pixels, for this part. I would recommend using Paint .net as it's free and does its job fairly well. You can find a link to their website here.[www.getpaint.net]

Once you've downloaded the toolkit, move it to your Freehold Games/CavesOfQud folder. This allows for the easiest way to modify the sprites and then move them over to your Mods folder.

For this part, we're going to modify everyone's favorite cat; Ctesiphus.

Enter the Tile Modding Toolkit folder, then go into the Creatures subfolder. You should see a screen that has a list of a bunch of sprites for the game.



Scroll down and find the bitmap image called "sw_kitty"



Now, open the image up in Paint .net



Let's do some real basic changes and give Ctesiphus some stripes on his belly.



Now, save this image as sw_kitty.png and put it in your New Mod folder.

Do note that it is necessary that you save these images as .png files and not as .bmp files, as the modified image will only be loaded if it is a .png file.



Before these changes to Ctesiphus can take effect, we're going to have to add some extra folders.

In your New Mod folder, create a new folder called "Textures"



Then, enter the Textures folder and create another folder called "creatures"



Now, move your modified "sw_kitty.png" into your Textures/creatures folder.




Now go back to the New Mod folder you created, and make a new file called ObjectBlueprints.xml and add the following code into it
<?xml version="1.0" encoding="utf-8"?> <objects> <object Name="Ctesiphus" Load="Merge"> <part Name="Render" Tile="creatures/sw_kitty.png"></part> </object> </objects>

Your file should look like this.



Save that file in your New Mod folder. Your New Mod folder should look like this.




Now, start up Caves of Qud and you should see two Ctesiphuses with striped bellies.




Currently, the sprites we have created are being colorized dynamically. If you want to change what color the sprites are being rendered with, take a look at my last guide on how to change Ctesiphus's color.

However! Though the system of dynamic rendering does limit our coloring options, there is a way to simply render the image as is, with any color options we choose.

Create a file called "modconfig.json" in your New Mod folder, and enter the following code:
{ "shadermode":"1" }

With this, you'll be able to draw whatever you want for your sprites, and they will be rendered literally, ignoring any dynamic rendering colorizations.

Here is an example!

How To: Create New Characters


So, by this point we've learned how to do three things
  • We know how to edit objects
  • We know how to place objects onto the map
  • We know how to edit sprites

With all of this available to us nothing prevents us from creating wholly original characters and putting them into the world.

So, let's take what we've learned and make a new character.

Let's make this character a new mod, so there's no overlap with the mod we just created.

Step 1: Make a folder for our new mod

This part's pretty simple; we've done it a bunch of times before. Let's call this folder "New Character" so we know what we're making.



Step 2: Create a new ObjectBlueprints.xml file

Since we're going to make a new object, we're going to have to modify the ObjectBlueprints file. Create a new new ObjectBlueprints.xml file and add the necessary code.

<?xml version="1.0" encoding="utf-8"?> <objects> </objects>



Now we need to create a new object that will be our newly created character.

To do this, add the following code inside the <objects>...</objects> tag:
<object Name="New Character" Inherits="NPC"> <part Name="Render" DisplayName="New Character"></part> <part Name="Brain" Wanders="False" Calm="True" Factions="Joppa-100"></part> </object>

This is the shell of our character. We don't have a sprite for this character yet, so let's do that next.

Step 3: Create a new sprite

Go to the Tile Modding Toolkit folder you downloaded and find a suitable sprite to edit, or if you're feeling particularly creative feel free to make your own sprite.

Take your chosen sprite and put it into Paint .net



Make whatever changes you want to the sprite. This is your new, original character after all. Have fun! Be creative!




Once you're happy with the sprite you've created, save it as a .png file in your Textures/creatures folders in the New Character folder you created for this new mod.



Make sure to add modconfig.json to your mod so your sprite renders without any dynamic colorization (unless you want it render as such).

Like before, add a file called "modconfig.json" with the following code:
{ "shadermode":"1" }




Now that we have a functioning sprite to load, let's go back to our ObjectBlueprints.xml file.

Here we need to add a section that tells the game to load our sprite.

Add the following code to your ObjectBlueprints.xml file, on the same line as the "Render" part:
Tile="creatures/name_of_image.png"



Now that the object has its behavior logic inherited from NPC, and we've given it a sprite to load, we are ready to place the character on the map!

Step 4: Putting our new character in Joppa

Create a new Joppa.rpm file in your New Character folder and place the following code inside it
<?xml version="1.0" encoding="utf-8"?> <Map Width="80" Height="25"> <cell X="40" Y="19"> <object Name="New Character"> </object> </cell> </Map>

This will place our New Character we've created at the coordinate point (40,19) in Joppa.

Now, start up Caves of Qud and behold your creation!



Here's some more code you can add and modify as you want to add a description or inventory to your character.

<part Name="Description" Short="A big ol' blue bear. Very scary. Who's ever seen a bear so blue? It's nearly unheard of! You feel like this may be a once in a lifetime event. The rarity of this sight fills you with awe."> <inventoryobject Blueprint="Black Robes" Number="1"></inventoryobject> <inventoryobject Blueprint="Sandals" Number="1"></inventoryobject> <inventoryobject Blueprint="StandaloneMarkovBook" Number="1-3"></inventoryobject>

Wrapping Up


Well, that's it!

I hope you found this guide useful. If you have any questions or comments, or if you spot any typos, feel free to leave a message here and I'll do my best to respond quickly.

Happy modding everybody! I hope you have a wonderful day!
5 Comments
Pin 11 Jun, 2021 @ 8:16pm 
two of them
funny cow 28 Nov, 2020 @ 8:30pm 
Thank you very much for the guide :)
Piesmartguy 25 Oct, 2020 @ 9:32am 
Nice guide, thank you!
Nico 25 Oct, 2020 @ 7:58am 
ew
kit 26 Aug, 2020 @ 12:13pm 
trans ctesiphus