256 Colour Tutorial Part 1: Difference between revisions

m
(Updated to V3.1.2)
Line 8: Line 8:


===Preparations===
===Preparations===
If you have made up your mind and have decided clearly that you want to use 8-bit graphics for your game, not only for the sake of simplicity, file sizes and speed, but mainly want it to be benefited from the fancy palette effects, you ''really should'' do some work in the planning stage, about the usage of the colour slots, ''before'' starting the production. The underlying reason is, unlike the "Direct Colour" modes (in which you can draw each piece of your graphics with ''any'' combinations of the available colours, without affecting one-another), you must take care of the dependencies in 8-bit modes. For example, if you set colour slot #50 to be yellow in one sprite, you can't make another sprite which may appear at the same time, to have slot #50 set to red. Moreover, if you use ''MANY'' variations of colours on your sprites, you may need to worry about the 256 limited slots all being used up quickly.
If you have made up your mind and have decided clearly that you want to use 8-bit graphics for your game, not only for the sake of simplicity, file sizes and speed, but mainly want it to be benefited from the fancy palette effects, you ''really should'' do some work in the planning stage, about the usage of the colour slots, ''before'' starting the production. The underlying reason is, unlike the "Direct Colour" modes (in which you can draw each piece of your graphics with ''any'' combinations of the available colours, without affecting one-another), you must take care of the dependencies in 8-bit modes. For example, if you set colour slot #50 to yellow in one sprite, you can't make another sprite which may appear at the same time, to have slot #50 set to red. Moreover, if you use ''MANY'' variations of colours on your sprites, you may need to worry about the 256 limited slots all being used up quickly.


When you start a new game in the AGS editor, by default (as of AGS V3.1), it will be a hi-colour one, so to use 8-bit graphics, the first thing you need to do is to change the ''Colour depth'' to '8-bit colour' in '''General Settings'''. Now, double click '''Colours''' in the editor's item tree, you'll see the default set of palette colours as follows:
When you start a new game in the AGS editor, by default (as of AGS V3.1), it will be a hi-colour one, so to use 8-bit graphics, the first thing you need to do is to change the ''Colour depth'' to '8-bit colour' in '''General Settings'''. Now, double click '''Colours''' in the editor's item tree, you'll see the default set of palette colours as follows:
Line 20: Line 20:
'''<u>Note</u>: Depending on the graphics packages you use, the channel ranges may be expressed differently. For example, in Deluxe Paint ][ Enhanced, each of the channels' intensity ranges from 0 to 100, and in some of the more "modern" programmes like Grafx 2 the range is probably from 0 to 255. In fact, there are a total of 64 intensity levels for each colour channel in 8-bit modes and this is what the AGS engine currently adopts. Unfortunately, in the current version of AGS, palette handling is quite ambiguous as you have to use values from 0 to 63 in ''scripts'', but the editor shows that each channel takes values from 0 to 255 (to match the colour picker provided by Windows), which is quite confusing. Nonetheless, when imported into the AGS editor, they will be hashed to the standard 64 level intensity internally anyway.'''
'''<u>Note</u>: Depending on the graphics packages you use, the channel ranges may be expressed differently. For example, in Deluxe Paint ][ Enhanced, each of the channels' intensity ranges from 0 to 100, and in some of the more "modern" programmes like Grafx 2 the range is probably from 0 to 255. In fact, there are a total of 64 intensity levels for each colour channel in 8-bit modes and this is what the AGS engine currently adopts. Unfortunately, in the current version of AGS, palette handling is quite ambiguous as you have to use values from 0 to 63 in ''scripts'', but the editor shows that each channel takes values from 0 to 255 (to match the colour picker provided by Windows), which is quite confusing. Nonetheless, when imported into the AGS editor, they will be hashed to the standard 64 level intensity internally anyway.'''


After having fun messing with the colours, it's a nice idea to quit the editor to discard of the nasty random colour tests you have made and restart it, and it's now time for the ''important part'' - to make the decision on the general usage of the slots - how many slots should be "Gamewide" so they'll be "''unchanged''" (words like "''unchanged''" are relative terms in my tutorials and you will find out why later...) through-out the whole game, and how many of them should be set as "'''Background'''" so they can be different in different rooms. I suggest that you divide the palette into 2 parts - the '''first part''' and the '''second part''', in which the first part is for the "'''Gamewide'''" colours, the second part is for the "'''Background'''" colours, and don't let them scattered around for the sake of better organisation. Now there're 256 colour slots in total, you may decide how many colours should be assigned as "'''Gamewide'''" (mainly for sprites) and use the rest as "'''Background'''" (mainly for room backgrounds as the name suggests). If for example, you want your sprites to look more cartoony and don't need much variations on their colours you may assign less colour slots to them (thus you can have more colours for backgrounds); on the other hand, if you need more colours for sprites you may assign more slots to them (the drawback is that you may have less free colours for room backgrounds). If you cannot make up your mind I suggest you divide the palette into two equal halves, that is, to use the first half (#0 to #127) for sprites and the second half (#128 to #255) for backgrounds, and if you do things right you can still change the assignment halfway through the production process if needed.
After having fun messing with the colours, it's a nice idea to quit the editor to discard the nasty random colour tests you have made and restart it, and it's now time for the ''important part'' - to make the decision on the general usage of the slots - how many slots should be "Gamewide" so they'll be "''unchanged''" (words like "''unchanged''" are relative terms in my tutorials and you will find out why later...) through-out the whole game, and how many of them should be set as "'''Background'''" so they can be different in different rooms. I suggest that you divide the palette into 2 parts - the '''first part''' and the '''second part''', in which the first part is for the "'''Gamewide'''" colours, the second part is for the "'''Background'''" colours, and don't let them scattered around for the sake of better organisation. Now there're 256 colour slots in total, you may decide how many colours should be assigned as "'''Gamewide'''" (mainly for sprites) and use the rest as "'''Background'''" (mainly for room backgrounds as the name suggests). If for example, you want your sprites to look more cartoony and don't need much variations on their colours you may assign less colour slots to them (thus you can have more colours for backgrounds); on the other hand, if you need more colours for sprites you may assign more slots to them (the drawback is that you may have less free colours for room backgrounds). If you cannot make up your mind I suggest you divide the palette into two equal halves, that is, to use the first half (#0 to #127) for sprites and the second half (#128 to #255) for backgrounds, and if you do things right you can still change the assignment halfway through the production process if needed.


Now, '''DO NOT CHANGE ANYTHING IN THE PALETTE''', this is not (yet) required in this stage. Right click the palette colours and choose "'''Export to file...'''", name the file and save it as a '''.BMP''' file, like [[media:8bittut_basepal.bmp|this]]. ''DON'T'' bother using the '''.PAL''' format, as ''most'' graphics packages nowadays can load '''.BMP''' files already and '''.PAL''' is an ambiguous file extension that different graphics packages may interpret the format differently. Even if your favourite graphics package cannot load '''.BMP''' files, you can change the files to a supported format using free conversion tools (e.g. [http://www.irfanview.com Irfan View]) which won't ''change the colours or mess with the palette slot orders during conversions'', which is '''VERY''' important if you take it serious and really want to use the 8-bit palette effects to the max. You can keep a copy of the saved file in a safe place for your convenience, in case you'll start another 256-colour project later (or just download the file linked above).
Now, '''DO NOT CHANGE ANYTHING IN THE PALETTE''', this is not (yet) required in this stage. Right click the palette colours and choose "'''Export to file...'''", name the file and save it as a '''.BMP''' file, like [[media:8bittut_basepal.bmp|this]]. ''DON'T'' bother using the '''.PAL''' format, as ''most'' graphics packages nowadays can load '''.BMP''' files already and '''.PAL''' is an ambiguous file extension that different graphics packages may interpret the format differently. Even if your favourite graphics package cannot load '''.BMP''' files, you can change the files to a supported format using free conversion tools (e.g. [http://www.irfanview.com Irfan View]) which won't ''change the colours or mess with the palette slot orders during conversions'', which is '''VERY''' important if you take it serious and really want to use the 8-bit palette effects to the max. You can keep a copy of the saved file in a safe place for your convenience, in case you'll start another 256-colour project later (or just download the file linked above).