Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python based image tools for NGPC development
#1
I had a use-case for needing to process an image into 3 layers for the NGPC, and with the aid of ChatGPT, I have put together an NGPC image processor in python with a GUI to accomplish what I needed.  It outputs the processed image data as a C header file. The output is compatible with what I had modified sodthor's CodeImage to output for my purposes.

It doesn't do as much processing as CodeImage and only supports 3 colors + transparent per layer.  The assumption being that only 1 palette per layer is being used.  I still use CodeImage to process my more complicated level tilesets because it supports multiple palettes per layer.  I have started using this new script for most other purposes since I already draw my sprite images to use only 1 palette per layer.

I briefly tried to get CodeImage's more complex image processing implemented in python while using ChatGPT, but it kept generating code that was too long for its character limit and I didn't have much motivation to work on it further since I already have CodeImage working for me.

I also put together a separate script with GUI with a color selector to get precise colors that are available on the NGPC.  This has some simple outputs that can be used in an image editor or in the C framework.

Github repositories for the 2 scripts:
NGPC-Image-Processor
NGPC-Color-Selector
Reply
#2
3 layers ? with sprites (only) and/or scroll planes ? great Smile
I could have tried to make it available in CodeImage...
Reply
#3
(02-18-2023, 12:09 AM)sodthor Wrote: 3 layers ? with sprites (only) and/or scroll planes ? great Smile
I could have tried to make it available in CodeImage...

Specifically I am having NPC interactions bring up a dialog screen where the character's portrait is displayed.  I have the portraits being 3 layers making use of 2 scroll planes and a layer of sprites.

You could conceivably make more advanced looking sprites with 3 layers, but you sure would run out of sprites quickly.  I felt like I ran out too quickly trying to do 2 layer sprites, so I have generally settled for 1 layer 1 palette sprites and try to keep that limitation in mind as I design assets.  I suppose, depending on the type of game being made, 3 layer sprites could be manageable.
Reply
#4
I updated the image processor to have an option to select the order of the colors in the palette.

I have tilesets that contain the initial placeholder for animated tiles, and then each animated tile gets all of its frames in a separate image per animated tile.  These frames overwrite the tile in tile RAM, assuming the palette is unchanged.  I process my tilesets through CodeImage, but its output of palettes and ordering of them is not predictable.  So when I am processing the animated tile frames that are meant to use the same palette as the one in the original tileset, I am most likely to end up with a palette in a different order, meaning I have the wrong colors displaying for the animated tiles.

The reason I do not simply write the palette from the animated tiles in my game is that other tiles from the tileset may be using that palette, meaning they would end up with incorrect colors.

To address that particular issue, I can now process my animated tile frames through this new image processor and sort the palette to match what came out of CodeImage for the tileset.  Now my animated tiles show with the correct colors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)