ZX Spectrum Next - Using Aseprite
Welcome back to another blog edition!
Since my Github repository has been updated with further features to my Spectre's Plugins, I thought I would do a new post on how some of these Plugins can be used in your Speccy Next game development.
Before we go further, you will need 2 things, Aseprite, and my Spectre's Plugins.
You can actually get Aseprite free, however to do this, you have to build it yourself from their Github. This is not a tutorial on how to build Aseprite, but their Github is here:
What I did, and to be honest what most do for convenience, is purchase from their site, or from Steam. (It is also on offer quite often, and appears in Humble Bundle packages.) The Aseprite website can be found here:
The plugins I have developed can be downloaded from my Github site, where I also have plugins previously mentioned for the Tiled editor. Instructions are included on the site, and of note, they can be used on any version of Aseprite for Windows, Mac, etc:
So what can you actually do with my plugins?
I actually started developing them to make my life easier when creating game assets. As I was already using Aseprite to do this, I wanted a process that when I had drawn or edited these, that I could then just export to a format the Next could actually use, without having to use other software to convert, or type commands into the shell to do this.
So the result is, you can now directly import & export, sprites, tiles, palettes and images. All this with full support of the Speccy Next priority bit, for example with palettes, to force all pixels set with this, to be drawn above all other layers.
Image export can auto rotate or flip, for correct loading on the Next. You can convert your palette to best suite the available colours on the Next, and create blank spritesheets with the default Next palettes with 256 or 512 colours.
More features will be added over time, but this is a good set of tools to make life easier. So download the plugins and I will crack on with some examples.
Creating sprites/tiles from an image
In this example I will use an image of some tiles freely available on Itch, from Brackey's platformer bundle.
You can see the image below I am using to export the tiles, loaded into Aseprite, but you can use your own or any other you might have or find. If the image is not in indexed colour mode, then select this from the menu, as it might be set to RGB or Grayscale.
I know that this colour palette won't have been taken into consideration for the Next as I have not created it myself, so first I want to recolour the palette to make it compatible.
I use my Palette Convert plugin for this:
This will open a pop up panel with settings to convert the palette using one of the following options:
- Euclidea
- Manhattan
- Chebyshev
- CIE76
- CIEDE2000
When you press convert, it will use the method selected to check the indexed palette colours of the image, and map them to the closest it can find from the 512 available 9bit colours of the Spectrum Next, hopefully without changing the colours too much. It is good to experiment here, as depending on the image colours, some options can give better results than others.
Once the palette has been remapped, it is then time to export the tiles or sprites.
This exports for either pixel sizes of 8x8 or 16x16 and available colours of 16 or 256. It is also worth pointing out that the plugin requires an appropriate image to have these colours, and for the width and height of the image to be a multiple of 8 or 16. (It will warn you if not the case.)
Once you have decided on pixels and colours, it will then ask for the number of tiles or sprites to export. The number which is auto populated here is calculated from the max number available dependant on the image size, however if for example your image could produce 72 tiles, but most of the space was blank, and there were only 10 tiles drawn on the image, you could change this number accordingly.
Then it's just a case of selecting where you want the file to be saved, for example a ".spr" or ".til", and then just press OK to export.
And the result, a ".spr" or ".til" file that can be loaded directly into the Next for your game.
Now you might say, what if your sprites you have exported are not using the standard 256 colour palette, but like in this case, are using 256 colours which have been modified from the Next's 512 available?
Well I have thought of that, and there is a plugin just for this to export palettes!
Palette's
So let's not forget we have already discussed remapping the colour palette for the Next, this can also be used for image export................ Oh! ...... Image export plugin, see further down for that!
Okay, so now let's export a palette ".pal" file for our sprites.
This is really quite easy to use, and brings up this panel. Here select where you want to save the file, but also you can export a 16 colour set of the 256 as an offset, as well as all 256 colours if you leave it set as "Off".
That's it really! The result is a file that again can be used on the Next.
Now at this point, I know what you are thinking! At the top of this blog post I said "full support of the Speccy Next priority bit, for example with palettes, to force all pixels set with this, to be drawn above all other layers". Well this can be achieved with the palette viewer plugin!
So once you have exported some palettes using the plugin above, you can then import them back into the viewer for tagging. The feature of this plugin is that you can tag colours in the palette, allowing the tagged indexed colour to have the priority bit set for further exporting.
Using this, the priority bit for Layer 2 can then force all pixels tagged to be drawn above all other layers in your game.
In this example, you can see I have tagged colours 1, 2 and 3 (0 is the first.) You can tag or un-tag all, and tag or un-tag specific colours, but once you have finished, you can then export with the tagged colours saved within the palette.
Now, this post is getting quite long, and there are other plugins to use like, creating a blank canvas ready to draw your sprites with a ready made compatible Next palette, and also for importing of Next sprites, tiles and palettes. These are really quite simple to use, and if you check my Github page, you will see further instructions on how to use these, with images.
However, I did promise you image export! So here goes.
Image Export
Again, all my plugins are made with ease of use in mind, but let's show an example of exporting an image to the Next which has a lot more colours than 256.
Now I'm not an expert artist. I can do some pixel editing for sprites, etc, but not with producing something like this Amiga demo image, which has over 4096 colours in RGB mode.
We could mess with the colours and if skilled enough do some dithering, etc to make it work, but lets see what we can do.
We know that currently the Next can't display this, who knows when KS3 comes out, it might be possible if a proposed 4096 colour option becomes available. (This is potentially 12bit colour, but we will see.)
Any image loaded into Aseprite with more than 256 colours will be in RGB mode, even though it shows only 256 colours on the palette. So first change this to Indexed from the menu.
As you can see, the image still looks very good, but we do lose some detail as the colour palette is reduced to an actual 256 colour palette.
Although we now have 256, the chances are, unless you are extremely lucky (and in that case put the lottery numbers on), you won't have a Next compatible palette.
So like earlier, experiment with the Palette Convert plugin, and it's options, to get the best colours compatible with the Next, to export the image.
Looking closer, you might again lose some detail, however, unless you are a skilled artist, this is still a good image to use. You could do some dithering, etc to improve it, but realistically, I'd be happy with this, and all that would be left, would be to resize for the correct format like 256x192 or 320x256.
Once you have resized your image, then export it.
It will give you options for bmp or bin, for bitmap or binary file options.
Putting that aside, the file extension doesn't actually matter. You could take a .nxi file and change it to .bin or even .idc for, I Dont Care, and it would work.
If you have Flip/Rotate set to off, obviously your exported image will be the normal way up, however, if set to Auto, this will save either 90 degree rotated CCW or flipped upside down for either a 320x256 or 256x192 image, like these below.
Comments
Post a Comment