Skip to content

Asset patching

Tibo edited this page Oct 21, 2020 · 10 revisions

A way to have stable asset modifications.

Setting up

Enable Enable assets modifier and click on save in the UI. This will show another section titled Assets modifier under the Settings. You can click on Add a patcher to add a mod. Select the x.mod.json file. You might need to clear browser cache to see them ingame.
Click on Pre-patch ALL assets to patch the currently cached assets. This may take a minute and will patch all files currently in cache that need to be patched and save these.
The assets it will replace will be loaded from x; relative to the folder of x.mod.json (put them next to each-other). Files will be patched on-the-fly if the patched cache is outdated. These patched files will be cached in your cache folder, under _patched/.

Public mods

Send a message if you want yours listed here.

  • English Patch by InochiPM and Oradimi
  • Kantai 3D (adds 3D secretaries) by laplamgor
  • Fixes by me - fixes maintenance screen not showing, 6-5 airbase offset
  • Example mod - result of steps below

Creating a mod

Metadata

Create a file with the extension .mod.json and a folder with the same name as the file (without .mod.json).
For example:
Example

This .mod.json file contains the name, version and the author(s) of the mod. For example:

{
    "name": "Example",
    "version": "0.0.1",
    "authors": ["YourName"]
}

You can now add your mod via the Add a patcher button.

Optional metadata

Since v2.6.0, mods can have their website/main page linked in the UI. As well as have an blinking "update available" button. These can be defined with the following:

  • url: URL to open when clicking Open website button. Button is hidden when not defined. (Heavily recommended)
  • updateUrl: URL to check for updates. This should point to the raw .mod.json file. (Required for update checking)
  • downloadUrl: URL to open when clicking the update available button. (Optional, otherwise uses url).

When clicking the Update available button, the urls fetched from updateUrl will be prioritized above the local ones. Since v2.6.3 mods can have custom patcher scripts that run when requesting to replace an asset. This requires requireScripts to be set on true in the .mod.json file. If set, users will be prompted to allow this before adding the mod.

Assets replacement / folder structure

Find the file you are looking for in your cache folder. Let's say you want to replace a sprite in kcs2/img/album/album_main.png. You can extract the individual images from these spritesheets with the Extract a spritesheet under Tools (first select the .png to split, then the folder to extract to). Inside your folder create the same path to the spritesheet as it is with your cache, and create a folder for your image. For example: create kcs2/img/album/album_main.png/. You can choose to either create the folders original and patched or start the filenames with original and patched. The rest of the filename must match (original/test.png will be replaced by patched/test.png). In the original you put the unedited assets, in the patched the edited ones.

Original/patched
TIP: If you plan on editing multiple files in a spritesheet, it'll be recommended to keep the same alphabetical order as the ID's in the spritesheet, this will optimize the patching a bit.

For patchers, you'll need a patcher prefix. These are JavaScript files that'll get run whenever that file is needed. See here for an example from the English mod that appends a script after main.js.

After adding an asset, click on Reload mod data to load these in the patcher. You can click on Pre-patch ALL assets to patch these. The patched versions will be stored in _patched/ of your cache folder.

Clone this wiki locally