Saturday, October 11, 2014

Adding a Character


With background graphics taken care of, it's time to go the next step and have a character sprite display over the top of it.

Because I'm using an indexed palette, I need to manually tell AGS the colours I want it to use for the characters in my game. This involves going to the palette editor and manually inputting RGB colour values for each individual colour in the character sprites I will be using. Happily, I'm going to be sticking to a very small colour palette for this game:


To convert the RGB values from the 0-255 values we use today to be recognized by AGS, which has a 0-63 colour range, I need to divide the values by a factor of 4. I believe the 64 values of each hue in VGA mode is a relic from the EGA mode which had a total palette of 64 colours to choose from (feel free to correct me on this if I've misunderstood).

The colours in the palette here that are marked with an X are reserved for the current background's colour - I can set these off or on if I need more colours, but for the small number of colours I'll be using on both sprites and backgrounds in this project I can leave this as is. Those colours marked with an L are locked colours - default shades I'm not able to edit.

With the hues in the palette (as close as I can get when dividing by a factor of 4), I import the sprite at the top of the post to the game. The result:


Here, several colours have been badly converted to other entries in the palette. It's messed up enough that I can't use this in the game. However, the backgrounds have been painted with the same base colours as the sprites (with blending providing the wider range of hues), so I should be able to set the sprite to use each room's background palette too, right? I tried this, and got a pretty good result:


That's quite good! A little different to the original sprite, but it's much closer to how I originally drew the sprite. Although all backgrounds share a common palette, I feel it's best to check with this sprite over another background. The result:


Not good. This is more messed up than I thought possible. Clearly I'm not going to be able to rely on room palettes after all, then. I'm going to need to figure out how to get my sprite palette to conform to the sprite palette I've put in the game without being able to get the exact hues right. This in mind, I took the palette in the game, imported the game's palette into Aseprite as the colour palette for an image, pasted the original sprite in, and fixed up the few colours that converted badly. This means the sprite now has every hue exactly the same as the hues present in the game. I import the sprite and test:


Perfect! To be sure, I test in another room (although now that I'm not relying on room palettes to dictate sprite colours, this should affect nothing - still, for the sake of testing):


Lovely! With this in mind, every sprite I create for the game now needs to be saved with the exact palette the game has. This should ensure that every sprite is imported perfectly, with no colours messed up. Let's hope - I don't think anybody could handle another post with the word "palette" repeated this many times ever again.

2 comments: