Palettes, colors, and BMP files

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, joltcountry

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Palettes, colors, and BMP files

Post by Chris H »

Hi all,

I'm starting a new thread so we can have some Q&A about how BMP files and palettes are used by ACK (including how to use them to import tiles)

To cover some of the basics:
  • ACK runs in 320x200, 256 color ("Indexed color" in Photoshop) -- the palette defines the colors, for example color 0 may be "black", 1 "blue", 2 "green", and so on.

    BMP files displayed during a macro can have any palette, so nothing special is required except that the macro do a "FIXPAL" command before it terminates, giving a "normal" palette back to the game.

    The "normal" palette for a game is either an ACK default palette, or the palette from "PALETTE.BMP" if one exists in the game folder. (Once again, a 320x200 file, although the contents of it don't matter because it's only reading the palette table from the file header, it's not looking at the image contents. Making one can be as simple as taking a screenshot from another DOS game you like or want to use art from, and converting it to a 320x200 256color BMP. In my case, for my game, I used a random Ultima VI screenshot, because I wanted to use their portrait artwork.)

    When drawing graphic tiles, you have 9 "brushes" which you can assign to whatever colors (from the palette) you like, whenever you like, with the "Setcolors" option -- there are also options in there to "replace whatever color the cursor is on" or "pick up whatever color the cursor is on".

    An easy way to make sure your image has the right palette (in Photoshop, anyway) is to open an image that you know is correct, paste your new stuff onto it (so your paste gets converted to the image's colors) and then "save as" whatever name you want. This is especially useful for preparing BMP files to use in the graphic tile "import from BMP" feature.
That should at least get us started. I'll take a look at those Wasteland tile BMP files I created last week, I may have accidentally made them in the palette I'm using for my adventure project instead of with the ACK default palette and if that's the case I will fix that.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Thanks for this thread Chris! I'll cut and paste some questions I posed in other threads. I'll make a new post for each one though.

Ok so if I were to take a new screen shot of Wasteland or use some Wasteland graphic I already have instead of the one you made the palette might then work? But if you saved that using the wrong palette why does it show the original Wasteland colors?

Edit: When I was experimenting with the tile editor I thought I remembered reading something in the manual about a way to replace a color globally so that if you replace it just once it replaces it for every tile and anywhere that color exists. Is that correct or did I misread that? If it is correct how is that done?
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

I just checked, and it looks like I did get the palette right on those WL BMP files. So they should import fine unless you have a custom palette.bmp loaded -- in which case how they look will depend on your palette. But in that case we may want to give some thought to why you're using a custom palette (you might need one, you might not)

Biffsnot
Posts: 16
Joined: Sat May 31, 2008 6:36 pm
Contact:

Post by Biffsnot »

Typing on phone so will be quick. I used the screenshot function in dosbox to get the pics. I dont think i had any color issues. I may have resaved using mspaint but I dont think I did. Wasteland only uses 16 colors and black and white are 2 of them so pallet problems should be minimal unless using windows screenshot feature whice takes the shot at desktop color depth, usually 16 or 32 bit as opposed to 4 bit. This makes boiling down to 4 or 8 bit color lose data and make guesses as to the intended color or flat out botch the job. Dosbox screenshot is a hotkey in readme file something like shift-f11 or somesuch. Not near computer to verify but give it a shot.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Thanks for clarifying - both of ya. Actually, when I saved that really tall image you made Chris it was saved as a png on my end so I knew right away I was going to have load into Photoshop and make some changes, especially since it needed cut up into smaller chunks. So I actually created my own BMPs from that and resized the canvas of them to make them fit. It wasn't pretty, one row at bottom cut off midway and extra space along one side but I wasnt worried since I knew I was only using it to extract individual tiles.

Initially I just changed it to indexed color palette which cut it down to just the colors it used then saved it as a 256 color BMP. But when I first tried it and it didn't work I went back into it and realized it was saved as 16 bit even though it was 256 colors. So I corrected that to 8 bit and then tried it but it still didn't work. Only then did I try using a custom palette which was simply the same file renamed palette.bmp [is it case sensitive?], and saved to my design folder. I'll try Biffsnots method of using DOSbox capture.
Last edited by Garth's Equipment Shop on Thu Dec 18, 2008 8:45 am, edited 1 time in total.
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

That makes sense -- but save yourself the work, I thought I had put a link on my earlier post to a ZIP file full of a bunch of BMP files that were already formatted for use with ACK, just dump them in the ACK\IMPORT folder and you're done.

In case I didn't -- here's a link:

www.80sgaming.org/ack/wasteland-tiles.zip

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Doh! Ok here's my sign. I just checked and saw that I completely overlooked that link! Lol. Thanks Chris.
Which of you is interested in my fine wares?

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Hey Chris. I deleted that custom palette I had and just copied your BMPs into the import folder and presto! they just worked with no modification whatsoever. Awesome man, thanks.

I also figured out the trick with the PgUp/PgDn and Crtl-L/Crtl-R to make importing tiles a little quicker. Not sure if that was documented or not cause I just kind of stumbled upon it as I was doing it and thinking to myself surely Chris made an easier way of doing this! lol. I imported most of the WL tiles I wanted. It was difficult to decide near the end and I got so damn close to getting them all. Fortunately the world map doesn't use many tiles to begin with and can be cut down even more if necessary to make room for others.

I dont remember where I asked this before or if it was answered yet but what is stopping me from using the animated tiles slots to hold extra non-animated tiles? How are they animated? Is it just pairs of tiles that alternate back and forth? If so then I could just use two identical tiles if I wanted to use the slots for non-animated tiles couldn't I?
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Great, I'm glad you got that working.

The separate "animation" tile can't be used the way you're describing, no, but you gave me an interesting idea -- I wonder if it might be possible to cheat that way... it would take an engine mod, but I'll check that out.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Yes - yes! Do it man! For the love of God! :mrgreen: Woohoo! This is gonna be great! Greater than a family sized basket of extra-saucy perfectly fried buffalo wings and a extra large tankard of Guinness! Hmmm... well maybe not THAT great but... aw hell what I am thinking yeah it'll be even greater than that cause it'll last much longer and won't cost nearly as much! lol.
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Here's my current thinking -- and it's still somewhat tentative until I dig into the code and see what it'll take to do it.

New object type: graphic space (name still to be determined)

Acts sort of like a "custom space" but instead of selecting the action parameter on placement, you select the graphic tile. (From the 2nd set, since there's so much extra capacity there -- I guess I'll have to call it something else, since it won't be strictly for animation anymore)

So you could make one object of this type called "sign" and place it once and give it the graphic of a shop sign, again and give it the graphic of a stop sign, etc.

Being a "space" you can of course make it passable, impassable, trigger actions, etc. But this way you can add more visual variety without burning through valuable graphic tiles *or* objects.

The only thing you won't be able to do is animate them, only regular spaces/obstacles/portals will have that ability.

I'll take a look at this soon and see how it goes. If it's doable I'll tackle it sooner rather than later; it would be really nice in my Ultima parody if I could implement the Ultima IV style signs (shop counters spelling out words) but it's obviously not feasible with the current tile and object budgets. (I'm nearly maxed out on both.)

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Well thats good to know that theres an incentive in there for you as well! Where there's a will there's always a way.
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Well, it's in and functional -- this little cheat turned out to be easy enough, because I'm not really changing much under the hood -- just making it show a different tile if certain conditions are met.

Anyway, it's much like what I described, except it's not a new object type, it's simply a setting you can do on a regular space or obstacle. When you're choosing the graphic tile, at the bottom of the screen it tells you to hit "P" if you want to set the appearance when you place the object on the map.

Objects set this way will appear with a "question mark" tile in the editors. When you place them on the map, you'll be prompted to pick a tile from the "secondary" set (I can't call it the "animation" set anymore, since we're using it for this now too)

When the player sees the object, it will show up as the tile you chose when you placed it. You can place it each time with a different tile, of course.

It seems to all be working happily, so I'm bringing it up as a new patch. I do plan to add a little more functionality -- I'd like to have it show up properly in the map editor. (Right now you just see a bunch of question marks) However don't let that throw you, it is indeed working properly during play.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

What a great Xmas pres, thanks Chris! Now I'm gonna create the first full blown Wasteland kit! Once I have all the easy stuff done I'll start on the macros to emulate WL specific features. Using the Wasteland Suite I have every dialog, and the wording for every action, and the names for every object in the game. And for the long messages that were in the manual I have the manual w/journal in text format.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Ok, after trying a half dozen different programs that claimed to be able to work with 8-bit 256 color palettes but in practice failed the test [because not one of them could leave the order of the original palette index well enough alone] I've finally resigned to the fact that my only means of converting a batch of import tilesets so that they use the default ACK palette while preserving their original likeness is with Photoshop.

So I loaded up Photoshop CS2, loaded one of my tilesets that needed to use an ACK palette and started recording my palette table conversion action. After recording the actions I exported it to an external executable file which Photoshop calls a "droplet." With this droplet in any folder you choose, or on your desktop [provided you have Photoshop CS2 installed of course] you can then drag any folder full of 8-bit 256 color graphics tiles or tilesets and drop it on this executable file.

It's icon is a decorative arrow with the Photoshop feather logo on it. When you drop a folder onto it Photoshop will then open if it isn't already open. And all the files in it will flitter by as if they were being opened and closed in an instant [because they actually are] and when it is done all will be converted over to the ACK palette and saved to the same folder the droplet is located with similar names but with a three digit serial appended to its original name.

So far I have only tested this on BMPs that were already 8-bit 256 colors, and of the correct dimensions, and only tried it in one folder so far [the ACK import folder]. I may find after some more testing that it needs some tweaking to work under other conditions. Also I will probably make a new one with extra steps in it to do more than just convert the color palette such as incorporating the actions I was doing with Image Magick earlier.

I uploaded the droplet to my forum. It can be found at:

http://www.seditionproject.info/forums/download/pal.exe
Which of you is interested in my fine wares?

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

THE PROGS THAT FAILED

Post by Garth's Equipment Shop »

In case anyone else has been searching for a prog capable of properly editing indexed color palettes I wish you the best of luck in your search. Here is a list of the progs I've tried and found to be inadequate for the task. Hopefully this will help you narrow your search down:
  • Deluxe Paint II enhanced for the PC. The best indexed palette support but only works with PCX and LBM formats.

    iMage - a more up to date clone of DPIIe. A nice prog but again, no good for our purposes. It doesn't respect the color index of imported palettes.

    Saint Paint - This one I had high hopes for. As it turned out once again, no, it doesn't really do what it claims to be able to do. It seems to have all the right options to mess around with indexed color palettes and to export and import custom palettes and what not but when you cut any image higher than 8/256 to the clipboard so you can paste it back after changing the palette over to the ACK palette it informs you that it cannot paste a truecolor image to an indexed 256 color image. And yes I did try converting the image before cutting and it still remembers the image as if it were true color. But besides that I could tell from the palette view that it too does not respect the ordered index of the ACK palette.

    Dogwaffle - no go.

    Gamesfactory - nada.

    ProMotion - no dice.

    Tile Studio - Has a cool tile find feature that can pick out tiles from a tileset but again poor indexed palette support.

    NewBurn - Another one bites the dust.

    Neopaint - one of my favorite old DOS paint progs. It too fails the test unfortunately.

    Image Magick - This I thought for sure was the one. It is totally command line driven and seemingly able to do most anything - even fancy commercial prog stuff - and yet I discovered its one weakness. No indexed palette support! Ouch! It joins the long list of others caught in the dead zone.
After trying all of these otherwise nifty little paint utilities I am amazed that the only prog I could find that could handle the task of properly handling golden age game graphics that require a specific ordered indexed 8-bit 256 color palette was actually also the latest and greatest in cutting edge commercial graphic software! Ok, well I am using a version that is now a bit outdated but it is pretty damn close to the latest version! All my version is really lacking are the new 3d functions of CS3. Eventually I'll get around to testing my droplet with CS3.

It would be nice if someone who already uses CS3 could test it for me. I just don't like CS3 all that much and would rather not have it taking up space on my HD. But I will load it up temporarily just for testing purposes. Maybe turn on System Restore before installing so I can just roll back to before the installation after testing.

EDIT: More progs soon to be tested for 8bit indexed palette compatibility and native support.

The Palette Suite
http://www.alister.eu/palsuite/downloads.html

Paint Shop Pro
Though I've used Paint Shop Pro for many years and went through many versions I haven't actually tested any version with the above specifications in mind. So I shall do that next as well. Both the early freeware or shareware versions and the much heavier bell & whistle laden 21st century versions up to PSP8. I have seen where tileset designers swear by PSP saying it was practically designed for creating or editing tiles. Having used both PSP and Photoshop extensively I cannot see how such conclusions were reached but I shall put them to the test nevertheless.

Tileset Pal 1.1
http://www.jazz2online.com/J2Ov2/downlo ... velID=3723
TilesetPal is an application made for easing the process of color reduction from a 24-bit image to an 8-bit palettized image, particularly for Jazz Jackrabbit 2 tilesets. With proper use of TilesetPal, color reduction becomes a breeze, and yields much better results than using the Remap Colors feature in JCS.

"Tileset makers" mentioned at jazz2online: Agama, Blade, Mirrow, Skulg?

A quick search revealed too many false positives connecting the names with totally irrelevant search results so I'll need to refine my search and keep searching the results until I get more info on these.

EDIT: Also looking at GIMP which seems to boast support for handling indexed palette images.
http://docs.gimp.org/en/gimp-concepts-palettes.html
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Awesome stuff! I use Photoshop 7 at home, but I have CS3 at work (although I apparently don't know my way around it half as well as you do) and I'll try out that droplet and see what happens.

qrl

Post by qrl »

GraphicsGale was made for low colour sprite work. The freeware version lacks GIF/ICON support and some features pertaining to animation, but otherwise it's fully functional.

In the palette panel:

Drag and drop a colour to swap it with another colour.

Hold shift and drag and drop to swap colours without affecting the image. (To organise your palette.)

Hold ctrl and drag and drop to copy the colour to another index.

To mix and fine tune colours, I suggest using the HSL bars instead of RGB.

There are commands in the palette editor's drop-down menu to copy/paste colours in large batches, make gradations between two colours, load and save palettes, and to combine duplicate colours. GG also tells you the index number and hex value when you mouse over a cell.

* Make sure the working image is set to indexed colour mode, otherwise the palette editor is useless.

* Beware of converting to hi-colour and then back to indexed mode, the index structure will be reformulated, and indices that have identical colours will be combined.

Hope that helps.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

@Chris - Thanks for offering to test the droplet. Let me know how that goes. A friend of mine is a huge fan of CS3 and we've attempted to help each other out with different projects we've had going. We came to the conclusion that CS2 and CS3 are very different in some ways though I am assuming that Adobe took backwards compatibility into account when they created the new 3d powerhouse CS bloatware. Kind of the way Microsoft was forced into half-baking kludgy code into the Windows NT command line shell in order to keep CMD.EXE backward compatible with COMMAND.COM.

I watched my friend's desktop while he demonstrated some cool new features for me and I was impressed by the 3d editing features which would definately come in handy for editing high res sprites in 3d and then saving in 2d for games made with RMXP or something. But I am so used to cs2 that I'm afraid my productivity would go way down trying to relearn everything that has been changed or rearranged. I am sure I'll end up taking the plunge and switching some day.

@qrl - Thanks for the info on Graphicsgale. That is one of the latest ones in my list along with quite a few others. I haven't tested everything on my list yet so I'll refrain from providing the next Pixel Prog review until then.
Which of you is interested in my fine wares?

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld »

Another option for indexed palette BMP editing is mtPaint, an open-source bitmap editor that I just stumbled across yesterday:

http://mtpaint.sourceforge.net/

It has support for the type of bitmaps used by ACK (256-color with indexed palettes). I was able to figure out how to make it do the main thing that I was interested in in about 15 minutes, which was:

1. Load an existing ACK bitmap (such as the worldmap skin)
2. Take a screenshot of something on the high-resolution Windows desktop
3. Paste the contents into the ACK bitmap
4. Convert the pasted contents from RGB format to the indexed palette already in use in the ACK bitmap

You can also load/save the palette by itself to and from a separate file.

Post Reply