2.1. Yes. Already...

Alright, so, after working with Ajmal who is using the asset in his recent game jam game, I realized that my idea to make palette swapping "more lenient" was probably a bad idea.
So, in the previous 2.0, when using an alt palette every single pixel you draw WILL use a color from the alt palette.  This may have some undesired results.  Especially if you are using some clever way to prevent specific parts of the sprite from drawing with an alternate palette, as Ajmal was.  

So, I've made a few changes. 
1. Swapping has now returned to the previous level of accuracy that I had in version 1.x.
2. However, if you were digging the more lenient color swapping, I have made it available for you to customize.
Modifying the tolerance value will affect how accurate palette swapping is.  If you feel it's not matching colors it should, increase this number until it feels right.  In most cases, I recommend leaving it at .004.
These constants are available in all 3 pal swap shaders.

Speaking of which, I think I need to re-iterate one of the new requirements for HTML5.  If you open up either of the HTML5 shaders, you will find a #define for "TexturePageSize".  In most cases, this will be the resolution you selected in your global game settings.  But if it doesn't seem to be working at all or very inaccurately, try going back into your global game settings and previewing your texture page.  Turns out, that no matter what you have it set to, if you have a single page and GM can fit it in something smaller than you set it to, it will export it at that smaller size.  This actually tripped me up for awhile while developing the shader for HTML.  I set my texture page to 2048 but it just would not work.  It was a suggestion by Sidorakh (fellow GM Discord Admin) to export it and see the ACTUAL size.  Lo and behold, 512x512.  So, really, can't emphasize enough for HTML users to double check the Actual texture page size.

In addition to updates to the shader itself, I've add a minor update to the Palette Builder.  I fixed a crash when trying to interact with the preview box without loading any sprites (Thanks for reporting, Adam!)
I've also included two hidden features.  I was planning on doing all sorts of crazy stuff, but decided to save it for 4.0 (which will be a full rebuild from the ground up in WPF instead of GML.  So what are these features?

1. Palette Crush

Does your art have too many colors that are just too similar to one another that it's driving you crazy and your artist doesn't seem to understand that #45B292 && #45B192 shouldn't both be used in the same sprite, then this feature is for you.   With an active project, press C on the keyboard. A dialog will pop up asking you for a "crush factor".  What the hell is a crush factor?  Think about it like this:  Every color is made up of 3 RGB values, each 0-255.  What crushing does is it will divide each RGB element by your crush factor, floor the result and then re-multiply them by the factor.  This results in similar colors being combined.  Every time you use this, a new palette will be added to your project with the new crushed palette.  You may need to modify the resulting colors again just like any palette, but the overall color count should be reduced, sometimes significantly.

Okay, now you have a palette with reduced colors but... then what?  The palette itself still has 34 entries or whatever.  So how does this help?

2. Sprite Export
This feature works for those of you in the above situation, but also those who don't want to actually palette swap anything at run time, they just want to mess with some colors and re-export their sprites with the new palette.

After saving your project locally, you can press X to export all your loaded sprites using the currently selected palette; so as it would appear in the preview window at the time.  A folder will be created next to your .pal file for the current project called <project name> exported.  Inside: all your sprites with the desired palette.

Downsides?  If you have TON of sprites like this, they must be added to the palette builder one at a time (sorry).  And, obviously, whatever the sprite was originally named has been lost.  I worked for awhile to make this better, but ultimately it was a ton of work, and I'll improve this feature in future versions.
So, if you in the situation described above, start a new pal project import the new, crushed version of the sprite, and your actual palette will represent the new, smaller palettes.


PaletteGenerator3.0.1.exe 3 MB
Sep 23, 2018

Get Retro Palette Swapper for GameMakerStudio 1 & 2

Buy Now$3.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.