Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Polymod Tutorial

Joalor64 edited this page Aug 3, 2022 · 5 revisions

Polymod Tutorial

Creating the Mod Folder

Create a folder in the polymods folder and rename it to whatever you want.

Doing this manually is not a problem, but it would be faster if you copy-and-pasted the Template in the polymods folder.

In-Game Mod Info

The information for the mod is stored in two files. Those two files are _polymod_icon.png and _polymod_meta.json.

In _polymod_meta.json, you can define the mod name, the name of the author, etc.

Now, about _polymod_icon.png, it's just a simple .png icon for the mod. Just keep in mind that whatever image it is, it will always be squishes into a 150 by 150 resolution. So a 1:1 aspect ratio is recommended for your image.

ModCore/Loading the Mod

ModCore makes it easy to append, replace, or merge files without editing the game's code.

Joalor64 Engine's ModCore is powered by Polymod. Polymod is what handles loading the relevant assets, ensuring they are injected properly. It also handles ensuring mods are loaded in the proper order.

Here's an example mod by Master Eric > here <

Asset Replacements

Asset replacements are simple; just place the assets in the relevant subfolder.

Here's what the mod folder might look like for a simple "XXX over Boyfriend" mod.

<modRoot> (rename this to whatever you want)
|- _polymod_meta.json
|- images
  |- characters
    |- BOYFRIEND.xml
    |- BOYFRIEND.png

By the way, appending to assets is only slightly more involved. Appending is used when you want to add to the end of a particular text file without getting rid of what's already there.

For example, using replacement on introText.txt will get rid of the base game's intro text values, as well as any that other mods may have added. This may or may not be what you want. Appending will put your values at the end of the file for other mods to add to.

To perfrom asset appending, place the assets in the relevant subfolder under the _append folder, like so. Note the underscore before it.

<modRoot> (rename this to whatever you want)
|- _polymod_meta.json
|- _append
  |- data
    |- introText.txt

Merging

Merging is the most convoluted. Use it only if you can't use replacement or appending.

Merging locates a given key in a file and replaces it with the intended value.

  • For CSV and TSV files, the value in the first column is assumed to be the ID. Each ID in the merge CSV is located in the base CSV, and that row is replaced with the row from the merge CSV.
  • For LINES text files, Polymod will check
  • For PLAINTEXT text files, Polymod will throw a warning that merging is not supported.
  • For XML files, you need to add a child key called merge which specifies the key and value to match on. All other values will be replaced. See here for more info.
  • For JSON files, create a single top-level array named merge. Each element is an object with two keys: A key target like abc.d[3].e, and a value payload.

Modpacks

If you have a mod with several parts that you want people to be able to install separately, the best way to do that is to make them separate mods, then make a modpack. This is an empty mod containing only a file defining the other mods that the game should load.

To create a modpack, make a mod containing a _polymod_pack.txt file with the following text:

foo:1.0.0,bar:1.*.*,abc,xyz

ModCore will search for, and load, the mods with the IDs foo, bar, abc, and xyz, in that order. It will fail any mods that fail the version check (foo must be exactly 1.0.0 while bar allows any 1.x version) and only load the mods which don't fail.

Clone this wiki locally