Modding: Difference between revisions

From Thrive Developer Wiki
Jump to navigation Jump to search
(→‎Steam Workshop: filled in workshop instructions)
Line 42: Line 42:


=== Steam Workshop ===
=== Steam Workshop ===
TODO: write instructions
To upload mods to the Steam Workshop you just need to have the mod installed locally and detected by Thrive. Then you can just hit the "upload" button in the mod manager to begin the process. First select the mod you want to upload and then use the buttons and forms that appear to fill in the necessary details, and then hit the upload button.

Revision as of 17:40, 26 November 2021


This page is the main hub for information regarding Thrive modding.

Note that a modding guide for Thrive is in progress, however some of the early notes below may be usable as is.

Creating Mods

Before you can start you will need a few tools depending on the type of mod you want to make.

If you want to change anything more than the contained JSON files in the game, you will need Godot editor.

Download Godot mono version. The latest is usually suitable but sometimes Thrive hasn't been yet updated to the latest version. You can refer to the setup instructions file in the main Thrive repository to find out which version is currently used.

Simple Asset Changes

Create a new folder and use the Godot editor to start a new project in the folder. You should name the folder with PascalCase naming convention. And name your Godot project with spaces in the name like "Pascal Case". When selecting the name of the folder to have your mod in, you should use the same name as you used for the Godot project folder.

When exporting make sure to not enable embedding the .pck file option

If you make an icon please size it down to about 128x128 and name it at least a bit uniquely, otherwise the loaded mods all overwrite the icon path with their own. For example "disco_icon.png"

Code Mods

TODO: find out how to do gdscript mods

CHECK THIS: do C# code not exported on current platform in a mod work on other platforms?

When doing mods that have custom scenes or code files it is a good idea to put them in a subfolder named after the mod. So for example you would have "DamageNumbers/DamageNumbers" folder containing scenes if the "project.godot" file is in "DamageNumbers" folder. This way when multiple mods are loaded (or new files are added to the base game) they won't conflict with your mod's files.

When adding classes their names need to be unique. For Godot tscn attached classes they can't be in namespaces, but for other classes you should use namespaces to minimize the chance of conflicting class names.

When using C# code in a mod, you need to extract the created .dll file out of the exported .pck file in order for it to be loadable. Alternatively you can dive into the ".mono/temp" folder to find the created dlls in the "ExportRelease" folder. However, with this approach you still need to trim out the files from your .pck that should not be in there, namely probably all of the .dll files. This is because your mod will become GPL licensed if you accidentally include the Thrive library in your mod's files, so this is important to trim out.

You can use godotpcktool for example to extract a .pck contents and trim out contents. You can also use it to check what files are contained in your mod and Thrive to verify that the paths are correct to resources you want to overwrite.

Putting the Mod Together

You can use the mod manager in Thrive to create a blank mod folder with an info file. After creating the mod folder you should put the .pck and optionally the extracted .dll files into it. You should edit the info JSON file to refer to your .pck and other resources correctly, for example to the mod icon if you have one. For the mod internal name you should use the same name as for the Godot project you created in an earlier step.

After the mod folder is populated you can start up Thrive and try to enable the mod to see if it works. Some mods may only work properly if the game is restarted in case the mod overwrites some resource that doesn't get reloaded without a restart.

Uploading Mods

If the mod works you can then zip up the mod folder for distributing to other people or upload it to the Steam workshop.

Steam Workshop

To upload mods to the Steam Workshop you just need to have the mod installed locally and detected by Thrive. Then you can just hit the "upload" button in the mod manager to begin the process. First select the mod you want to upload and then use the buttons and forms that appear to fill in the necessary details, and then hit the upload button.