Utilities

To make modding easier, there is a utility program included with Chess EXTREME in the Utilities folder called sprite_background_remover.py. This is a Python script that can be used to both remove the background from individual sprite frames as well as assemble those frames into sprite sheets compatible with Chess EXTREME while generating a pieces.ini file for you.

Setting Up

To use the utility, you will need to have Python installed on your system as well as the Pillow library. You can install Pillow by opening PowerShell or Command Prompt and running the following command:

pip install Pillow

Using the Utility

Once you have Python and Pillow set up, you can run the utility from the command line. The utility has two main functions: removing backgrounds and assembling sprite sheets.

To run the utility, use the following command:

python sprite_background_remover.py <input_directory> --assemble --sprite-type <type> --output <output_file>

Replace <input_directory> with the path to the folder containing your individual sprite frames.

The --assemble flag tells the utility to create a sprite sheet from the frames.

The --sprite-type option specifies whether you are creating piece sprites or explosion sprites; use piece for chess pieces and explosion for explosion animations, very important to define as it tells the utility to use what keys or definitions to use when generating the .ini.

The --output option is optional, but allows you to specify the name of the output sprite sheet file.

By default, the utility will remove the background from all PNG images in the specified input directory and save the assembled sprite sheet to the same folder it found the frames in.

As this was made originally for easily converting C&C .shp files, the utility assumes a green background (0x58fc54) to be replaced with a half-transparent black. I’d recommend using an image editor to change the background colour of your frames to this specific green before running the utility if a different shadow colour is used. Another C&C specific thing is that the utility assumes the frames are ordered with a four-digit numbering system (e.g., WP_idle_0000.png, WP_idle_0001.png, etc.). Make sure your frames follow this naming convention so the utility can actually find and process them correctly.

After running the utility, the newly created sprite sheet and pieces.ini file will be ready for use in your mod. Simply place them in the appropriate directories within your mod folder structure and they should work in-game.