Skip to content

Adding Content

Alchyr edited this page Sep 17, 2024 · 19 revisions

From here, what exactly to do depends entirely on what you want to make, but regardless of the specifics, there's some useful general advice.

Decompiling

For most things you'll make, there will be something similar in the base game or in another mod you can learn from.

You can view base game code using IntelliJ's built-in decompiler, Fernflower, or an external decompiler like jd-gui. (Decompiling on BaseMod wiki)

For in-IntelliJ decompiling, double-tap shift and click the check box to enable Include non-project items. You can tap shift 4 times to accomplish the same thing. Then just search for whatever you want to look at and open it. You can also Ctrl+Click on things to view their definition, but this doesn't work in decompiled code. If you really want to explore the game's code and not just view specific pieces, I would recommend going with an external decompiler.

Other References

For other mods, a large portion of them are available on github, though it make take some searching to find them. You can also try asking in the #modding-technical channel of the Slay the Spire Discord server.

For references, the most useful will likely be the BaseMod, ModTheSpire, and StSLib wikis.

The BaseMod wiki explains how to add various types of content using the hooks it provides, along with other features that you may find helpful for the content you're trying to create. I would recommend this one first.

The ModTheSpire wiki explains patching, which will be necessary for more complicated mods, such as if you want to add your own mechanics.

StSLib provides some commonly-used features, mainly for cards and relics.

There's also the wiki for libGDX, the framework used by Slay the Spire. This wiki can help you understand how the game works, along with having useful lower-level information. You probably won't need this for making a mod, though.

If you know what you want to make but can't find the information you need, I would recommend going to the Slay the Spire discord and asking around in the #modding-technical channel.

Mod-Prefixed IDs

For the sake of avoiding conflicts when multiple mods try to add things with the same name, the mod's ID is used as a prefix on content you create. If your mod's ID is "beans", a "Strike" card would have the ID "beans:Strike". A "Jar" relic would be "beans:Jar". BasicMod is designed to handle a lot of this without too much manual work, but it's important to be aware of.

In localization files (does not work in code), ${modID} will automatically be replaced with your mod ID. In code, the makeID method is used to add the prefix. The guide/example pages on this wiki will show its use where necessary.

Related: Keywords Card Descriptions

More Specific

Feel free to delete any of the Base____ classes if you're 100% confident you're not going to be using them.

If you plan on making a character, start from Adding a Character and then move on to Adding Cards, Relics, and Potions.

If you want to just add content to existing characters, just go straight to whichever relevant page for the type of content you want to add.

If you're making something else entirely, you'll probably need a lot more than a short tutorial can give you. You can find documentation for various types of projects elsewhere, but as previously mentioned, the easiest way to find out what you need will be to look at mods that do something similar- and to find those, the easiest way will probably again be #modding-technical.

Clone this wiki locally