Personally, I chose to not use ImageMagick but Python with Pillow and numpy for my scripts. It is maybe a bit slower (can take 1 or 2 seconds to process the full spritesheet for certain operations) but I can do whatever I want.
- coerce: takes an RGBA image and a palette (in .gpl, JSON, or PNG format), and produces an indexed PNG image which only uses colors from the palette (optionally, could force "nearby" but non-matching colors to use those from the palette)
As Baŝto noted, indexed PNG has some drawbacks and I find it simpler to just use a one channel grayscale image to store the indices and a separate RGBA PNG file with one row to store the palette. The main drawback is that you have no "standard" palette that goes with the image and you need to apply a palette to modify the image with sensible colors, and then to get back the new indices. It is a bit cumbersome.
You can have a look of what it looks like in this repo: the "indices" folder contains the grayscale images, the "palettes" folder the RGBA PNG with one row, "body_parts.json" makes the link between the grayscale image and the palettes, and allows to apply several palettes to one grayscale image. "generate_colored_images.py" is the Python script that generates all the images in "images" folder.
I have three scripts to manage indices and palettes:
- get_palette: it takes a RGBA image as input and outputs the palette (with an option to merge similar colors), and the indices.
- get_indices: it takes a RGBA image and a palette as inputs and outputs the indices (and an error if there is a color not present in the given palette).
- apply_palette: it takes a grayscale image and a palette as inputs and outputs a RGBA image.
It's a bit tricky to decide on what to use, since git won't work well and svn being very centralized, which can be very impractical if the repo gets deserted and dies. Images are binary data, which works badly with diff-based tools like git. But when git or such is used, it would be a lot more handy for version control to have an image per frame. It's easier to sew which frames were changed in commits, it's easier to merge commits and image diffs are harder to see in bigger images. This is a lot harder to work with drawing-wise, though.
I am using the Git LFS extension to manage the PNG (and the other binary files) of my repo and it works well so far. It is supported on GitLab and GitHub (never tried on this platform).
I also have scripts to transform a male head to a female head (basically just a list of offsets). And a script to detect and fix inconsistencies between the west and east facing animations.
Hey, sorry for the late response, I was working on other things.
The south facing animation is definitively weird but I made several experiments and that is the best I could do with existing frames. But when players will use the south facing animation when chopping/mining, they will be partially hidden by a tree/ore vein so that mitigates a little the issue.
Yeah, the goal of this animation was to not add new frames to the base character to not have to work on clothing. But as there is discussion to add new frames to the base animation on the other topic, maybe it will be useful for these weapons. By the way, BenCreating, I am not sure to see how the weapon should be placed on your proposed animation.
In general, I am not fond of of motion blur, but I agree with you that in this case, it could make the animation smoother. I have no experience with motion blur so it is maybe beyond my skills and I think it should be different for each weapon so I am a bit reluctant to start working on this.
I reworked a bit the west/east animation (just changed the hand position). I made the walk cycles (added 3 new rotations for that). And I made the female versions. For now, only the axe and the pickaxe are ready but I will finish the other weapons too.
I think the animations are not perfect but already usable and it is a large improvement comparing to the old ones. I think I will use these versions in my game. I will look how things go on the other topic: if a new animation for the base character is done for smash/chop, I will surely revisit this. If not, I think I will commission improvements.
Do you think I should make a submission for these animations at this state or I wait the definitive version?
EDIT: Is anyone interested in the script I used to generate the animation?
EDIT2: Oops, I just realize I put the weapon in the wrong hand for the west/east walk cycle. I will fix that. Fixed!
Hey! I keep slowly fixing issues with items. I just finished reworking the spear and the shovel for male and female characters (fixed the thrust animation and rework the walking animation, see the joined gifs).
Where do you want me to upload the reworked spritesheets? In a new submission on OGA? Here? In a particular git repo? In all cases, I will upload them on my repo.
The frame 2 of the shoot animation has the same issue as the frame 2 of the thrust animation. I adapted a part of the clothing to my changes.
I plan to write a script to detect inconsistencies between the west and east directions in clothing. I already fixed some and I suspect there may be more.
I think that using HTML for the interface and JavaScript for the logic would be the lighter (you literally just need a text editor and your browser) and the easier way to achieve this. If you have no text editor, I advise you Visual Studio Code, it is free, easy to use, and it will help you with HTML and JavaScript.
You will find a lot of documentation on the web, but I can advise you to have a look at Mozilla Documentation, I think you will be interested by the HTML, JavaScript and Forms sections.
You can also surely achieve this by asking StackOverflow and copy-pasting snippets. ;)
@bluecarrot16 OK, I will publish the grayscale images, the palettes I used, my scripts, and generate all the colored variations.
Yeah, I think it would be nice to have a repo with this kind of scripts. What would be perfect is a reference script for each body part type, it would drastically ease the creation of new items, which is currently a pain.
You are still using Ruby/ImageMagick?
@Evert You adapted a lot of body parts to the new animations?
Thanks! Sharing with others is always a nice experience, I have so much feedback from this first version, it will take me weeks to fix/improve everything. I would be delighted to read your devlog.
The shadow casting on walls was a last minute addition, I was not sure but one of my brothers convinced me to add it. It still needs some polishing. Do you know any other game that uses this? I would be glad to see a screenshot of yours!
I use a special format to store the images: I have grayscale images where the values correspond to the indices of a color in a palette. So to have a colored image, a grayscale image and a palette are needed.
This format allow me to quickly fix all the variations of a body part and to make sure the colors exactly match for body parts that use the same palette (body, nose and ears, or male and female versions for example).
But I am not sure this format is very useful to other people, so I will apply the palettes to the grayscale images to generate all the colored variations. I am writing a script to achieve this automatically but it takes some time.
There are small tweaks that will be easy to merge upstream. However, I modified the female base character as there are few issues with it. Subsequently, I had to modify many items but I don't use all the items present in castelonia's LPC Spritesheet generator, so not all of them are fixed.
Personally, I chose to not use ImageMagick but Python with Pillow and numpy for my scripts. It is maybe a bit slower (can take 1 or 2 seconds to process the full spritesheet for certain operations) but I can do whatever I want.
As Baŝto noted, indexed PNG has some drawbacks and I find it simpler to just use a one channel grayscale image to store the indices and a separate RGBA PNG file with one row to store the palette. The main drawback is that you have no "standard" palette that goes with the image and you need to apply a palette to modify the image with sensible colors, and then to get back the new indices. It is a bit cumbersome.
You can have a look of what it looks like in this repo: the "indices" folder contains the grayscale images, the "palettes" folder the RGBA PNG with one row, "body_parts.json" makes the link between the grayscale image and the palettes, and allows to apply several palettes to one grayscale image. "generate_colored_images.py" is the Python script that generates all the images in "images" folder.
I have three scripts to manage indices and palettes:
- get_palette: it takes a RGBA image as input and outputs the palette (with an option to merge similar colors), and the indices.
- get_indices: it takes a RGBA image and a palette as inputs and outputs the indices (and an error if there is a color not present in the given palette).
- apply_palette: it takes a grayscale image and a palette as inputs and outputs a RGBA image.
I am using the Git LFS extension to manage the PNG (and the other binary files) of my repo and it works well so far. It is supported on GitLab and GitHub (never tried on this platform).
I also have scripts to transform a male head to a female head (basically just a list of offsets). And a script to detect and fix inconsistencies between the west and east facing animations.
Hey, sorry for the late response, I was working on other things.
The south facing animation is definitively weird but I made several experiments and that is the best I could do with existing frames. But when players will use the south facing animation when chopping/mining, they will be partially hidden by a tree/ore vein so that mitigates a little the issue.
Yeah, the goal of this animation was to not add new frames to the base character to not have to work on clothing. But as there is discussion to add new frames to the base animation on the other topic, maybe it will be useful for these weapons. By the way, BenCreating, I am not sure to see how the weapon should be placed on your proposed animation.
In general, I am not fond of of motion blur, but I agree with you that in this case, it could make the animation smoother. I have no experience with motion blur so it is maybe beyond my skills and I think it should be different for each weapon so I am a bit reluctant to start working on this.
I reworked a bit the west/east animation (just changed the hand position). I made the walk cycles (added 3 new rotations for that). And I made the female versions. For now, only the axe and the pickaxe are ready but I will finish the other weapons too.
I think the animations are not perfect but already usable and it is a large improvement comparing to the old ones. I think I will use these versions in my game. I will look how things go on the other topic: if a new animation for the base character is done for smash/chop, I will surely revisit this. If not, I think I will commission improvements.
Do you think I should make a submission for these animations at this state or I wait the definitive version?
EDIT: Is anyone interested in the script I used to generate the animation?
EDIT2:
Oops, I just realize I put the weapon in the wrong hand for the west/east walk cycle. I will fix that.Fixed!Hey! I keep slowly fixing issues with items. I just finished reworking the spear and the shovel for male and female characters (fixed the thrust animation and rework the walking animation, see the joined gifs).
Where do you want me to upload the reworked spritesheets? In a new submission on OGA? Here? In a particular git repo? In all cases, I will upload them on my repo.
The frame 2 of the shoot animation has the same issue as the frame 2 of the thrust animation. I adapted a part of the clothing to my changes.
I plan to write a script to detect inconsistencies between the west and east directions in clothing. I already fixed some and I suspect there may be more.
It was a great pleasure to work with you! :) Hope it will be useful!
Here are the body parts used in Vagabond: https://gitlab.com/vagabondgame/lpc-characters.
There is a README that should explain everything.
If you have any comment or suggestion, let me know.
I think that using HTML for the interface and JavaScript for the logic would be the lighter (you literally just need a text editor and your browser) and the easier way to achieve this. If you have no text editor, I advise you Visual Studio Code, it is free, easy to use, and it will help you with HTML and JavaScript.
You will find a lot of documentation on the web, but I can advise you to have a look at Mozilla Documentation, I think you will be interested by the HTML, JavaScript and Forms sections.
You can also surely achieve this by asking StackOverflow and copy-pasting snippets. ;)
@bluecarrot16 OK, I will publish the grayscale images, the palettes I used, my scripts, and generate all the colored variations.
Yeah, I think it would be nice to have a repo with this kind of scripts. What would be perfect is a reference script for each body part type, it would drastically ease the creation of new items, which is currently a pain.
You are still using Ruby/ImageMagick?
@Evert You adapted a lot of body parts to the new animations?
Thanks! Sharing with others is always a nice experience, I have so much feedback from this first version, it will take me weeks to fix/improve everything. I would be delighted to read your devlog.
The shadow casting on walls was a last minute addition, I was not sure but one of my brothers convinced me to add it. It still needs some polishing. Do you know any other game that uses this? I would be glad to see a screenshot of yours!
I use a special format to store the images: I have grayscale images where the values correspond to the indices of a color in a palette. So to have a colored image, a grayscale image and a palette are needed.
This format allow me to quickly fix all the variations of a body part and to make sure the colors exactly match for body parts that use the same palette (body, nose and ears, or male and female versions for example).
But I am not sure this format is very useful to other people, so I will apply the palettes to the grayscale images to generate all the colored variations. I am writing a script to achieve this automatically but it takes some time.
Thanks!
There are small tweaks that will be easy to merge upstream. However, I modified the female base character as there are few issues with it. Subsequently, I had to modify many items but I don't use all the items present in castelonia's LPC Spritesheet generator, so not all of them are fixed.
Pages