Version 0.7 - Export redone


For this update I rewrote the export process.

Now, instead of beeing hardcoded, it is defined in json files. This way anyone can define their spritesheet layout.

Using the reworked export system, and the collaboration of RyanBram, the app can now export spritesheets for RPGMaker.
Thanks Ryan.

To export in RPGMaker format, you need to change the following settings in chargen.ini:
  • "export_layout": "export/rpgmaker.layout"
  • "export_individual_sheets": false

To explain how to create new layouts, I need to explain how the generator loads its resources.

(I've done this in v0.2, but for completeness sake, let's go again...)

The application loads it's resources from the following locations:

  1. {USER_FOLDER}/CharGen/data/
  2. {APP_FOLDER}/data/
  3. {USER_FOLDER}/CharGen/data/chargen.pak
  4. {APP_FOLDER}/data/chargen.pak
  • {USER_FOLDER} is where user specific data files are stored (e.g. ~/.local/share/ in linux, C:\Users\UserName\AppData\Roaming\LPC\ in Windows)
  • {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 modify existing ones.

Currently the chargen.pak contains 3 spritesheet layouts:

  • export/lpc.layout
  • export/compact.layout
  • export/rpgmaker.layout

Let's now create a new layout, called mysprites.layout.


We first create the file {USER_FOLDER}/CharGen/data/export/mysprites.layout (or {APP_FOLDER}/data/export/mysprites.layout).

These layout files are always a json array and each array element defines a spritesheet image file.


Let's look at one such element (example):

{
    "name": "universal",
    "suffix": "universal",
    "type": "universal",
    "frames":
    [
        [ "THR_UP_0_0", "THR_UP_0_1", "THR_UP_0_2" ],
        [ "THR_LF_0_0", "THR_LF_0_1", "THR_LF_0_2" ],
        [ "THR_DN_0_0", "THR_DN_0_1", "THR_DN_0_2" ],
        [ "THR_RI_0_0", "THR_RI_0_1", "THR_RI_0_2" ],
        [ "IDL_UP_0", "IDL_UP_1", "WLK_UP_0" ],
        [ "IDL_LF_0", "IDL_LF_1", "WLK_LF_0" ],
        [ "IDL_DN_0", "IDL_DN_1", "WLK_DN_0" ],
        [ "IDL_RI_0", "IDL_RI_1", "WLK_RI_0" ],
        [ "SLA_UP_0_flip", "SLA_UP_1_flip", "SLA_UP_2_flip" ],
        [ "EMPTY", "SLA_LF_1", "SLA_LF_2" ],
        [ "SLA_DN_0", "EMPTY" ],
        [ "SLA_RI_0", "SLA_RI_1", "SLA_RI_2" ]
    ]
}
  • The name is just an internal id, and must be unique within each layout file.
  • The suffix is appened to the exported file names, so if you are exporting with the name "aa", in this case the file "aa_universal.png" is created.
  • The type can be 'universal' or 'single'. This is used in the following way:
    • If the character USES large sprites (by using one of the large weapons), the 'universal' layouts are NOT used, and all the single layouts are generated.
    • If the character DOES NOT USE large sprites, and the ini parameter 'export_individual_sheets' is set to true, the 'universal' layouts are NOT used, and all the single layouts are generated.
    • If the character DOES NOT USE large sprites, and the ini parameter 'export_individual_sheets' is set to false, all 'universal' layouts are generated while all the single layouts are NOT used.
    With this I try to cover the situations where some people can use a single spritesheet with all the small sprite animations, while some people need a file for each animation.
  • Finally, the frames. Each row defines a row of sprites in the spritesheet, and each frame is defined by the following codes, separated by '_':
    • The first 3 charactes define the animation.
      • IDL - Idle
      • CST - Cast
      • THR - Thrust
      • WLK - Walk
      • SLA - Slash
      • ISL - Reverse slash
      • SHT - Shoot
      • DIE - Hurt
    • The next 2 characters define the orientation
      • UP - Up
      • LF - Left
      • DN - Down
      • RI - Right
    • The next parameter, when present, defines what the character is holding (if not set, value 1 is used).
      • 0 - Paint the sprite without any weapon
      • 1 - Paint the sprite with the primary weapon
      • 2 - Paint the sprite with the alternate weapon
    • Next comes the frame number in that animation. The intervals for each animations are:
      • IDL - [ 0 , 1 ]
      • CST - [ 0, 5 ]
      • THR - [ 0, 6 ]
      • WLK - [ 0, 7 ]
      • SLA - [ 0, 4 ]
      • ISL - [ 0, 4 ]
      • SHT - [ 0, 11 ]
      • DIE - [ 0, 4 ]
    • Finally, the last parameter defines if each sprite should be mirrored:
      • flip - flip the sprite horizontally

When the new layout file is completed, we finally edit the chargen.ini file to tell the generator to use it. That is done setting the parameter "export_layout": "export/mysprites.layout"

Notes:

  • The value 'EMPTY' can also be used, to define a empty sprite in the spritesheet.
  • You don't need to make all rows the same size. The generator uses the larger one as reference and fills empty slots with 'EMPTY'.
  • You can mix small and large sprites. The generator automaticaly converts small sprites to larger ones if needed.

Secondary weapon:

  • RPGMaker spritesheets use unarmed, melee and ranged weapons sprites on the same image. For that reason I added the ability to configure a secondary weapon slot.
  • You toogle the active slot with the TAB key.
  • So far it's only used in the RPGMaker exporter, but might be useful for someone.

That's it for this update. Have fun.

Files

CharGen_v0.7.zip 11 MB
Jan 10, 2024
CharGen_v0.7.tar.gz 11 MB
Jan 10, 2024
CharGen-0.7-x86_64.AppImage 13 MB
Jan 10, 2024

Get LPC Character Generator

Leave a comment

Log in with itch.io to leave a comment.