Posted February 22, 2023 by pflat
#update
This update gives the ability to change the character and accessories color palettes, at runtime.
Currently, three palettes were added:
There's also a new palette (LPC-512). This is the default palette with the color number reduced to 512 (actually 509).
In order to explain the process to create/change palettes, we need to first understand how the application loads its resources.
The application loads it's resources from the following locations:
{USER_FOLDER} is where user specific data files are stored (e.g. ~/.local/share/)
{APP_FOLDER} is where the chargen executable is located (e.g. /usr/local/bin)
The numbers indicate each location priority.
That way, if, for instance, the file {USER_FOLDER}/CharGen/data/data/character/race/zombie.race exists, then
the one inside the {APP_FOLDER}/data/chargen.pak will not be used.
The priority order is arranged so that loose files take precedence over the packed ones.
This allows users to add new items to the generator (and change existing ones).
Back to creating palettes.
The tools to do so are provided by the application. Issue chargen --help to get an explanation of these tools and their parameters.
I tried to make their description very thorough, and I hope the examples contained there better show how to use them.
First, every new palette is always based on an existing one, so let's first extract an existing one from the chargen.pak file (it's a regular .zip file).
Let's, for instance extract data/colormaps/lpc_509.cm and place it in {USER_FOLDER}/CharGen/data/data/colormaps/new.cm
Edit the file to change it's id and it's name. This new palette should now be available in the application.
Now, there's two ways to change it.
Either option gives a functional new palette that is immediately available in the application.
That's it for this update. Have fun.