Hello, project @ann, and preferred picture format Q

Hello…

I thought it was high time I introduced myself, mentioned my project,

and asked the first of what I hope will be very few questions…

My name is Nathan Yawn, and I'm from the embedded side of the tracks,

at least in my day job. My project is a 2D, turn-based, side-view
artillery-type game, in the tradition of “Tank Wars” and “Scorched
Earth”. It’s called “Terrain Alteration”. It’s quite playable under
Linux/x86, though parts of the interface are still console-based. It
has no web page, but if anyone’s really curious I can make the source
available.

Anyway, my question may be more philosophical than technical, but here

goes: What is the preferred image format for games (like this one)?
When I started writing, I used GIF, because that and BMP were the only
SDL-supported choices at the time. Would I be better off with another
format? (Will Unisys lawyers care if I release the game using GIF?)
What do you suggest, what are other people here using, and why?

Thanks for your answers...

Nathan Yawn
@Nathan_A_Yawn

Hi,

    Anyway, my question may be more philosophical than technical, but here

goes: What is the preferred image format for games (like this one)?

Here are my “image loading experiences”: :slight_smile:

At first, I used the Xpm library to load XPM files, but there were some people
which did not have this library or had problems to compile it, so I decided to
write my own image loading functions. Another reason was that the XPM image
format is a “human readable” image format (in fact, it’s C source) and therefore
produces quite large image files (which can be used in gzipped format with newer
versions of Xpm library).

So, I wrote a loader for GIF images for my games, because GIFs are
popular and quite small. But then there was all this Unisys trouble (regarding
not only programs that write GIFs, but also those that read them – in fact,
all programs that use their patented algorithms needed for GIF
encoding/decoding).

So I decided to drop the GIF format.

When looking for an alternative file format, I directly skipped the Windows BMP
format because of being so terribly bloated. Just get this single line from
"CHANGES.txt"
from Bill Kendrick’s SDL game “madbomber”:

  • Zen mode background created at runtime (removing about 1MB of file data).

Hint: This file just contained two big, single colored rectangles…

I then took the PCX format, which is simple and produces relatively small files
(with a simple run length encoding, therefore produces files which are a bit
larger
than GIFs, but far away from those bloated BMPs).

This was before the PNG format was developed, so maybe I would choose the
PNG format now if I would again work on it.

When I started writing, I used GIF, because that and BMP were the only
SDL-supported choices at the time. Would I be better off with another

Now SDL’s IMGlib supports PCX and PNG, too.

format? (Will Unisys lawyers care if I release the game using GIF?)

Probably not, if it’s Freeware, but who knows exactly… :-/

What do you suggest, what are other people here using, and why?

Just my 2 cents. Hope you found something useful. :slight_smile:

Best regards,
Holger–
Holger.Schemel at mediaWays.net ++49 +5241 80-1438

Anyway, my question may be more philosophical than technical, but here
goes: What is the preferred image format for games (like this one)?
When I started writing, I used GIF, because that and BMP were the only
SDL-supported choices at the time. Would I be better off with another
format? (Will Unisys lawyers care if I release the game using GIF?)
What do you suggest, what are other people here using, and why?

I use BMP because the plain SDL library supports it (ie, no extra libraries
or code required to compile it).

Also, BMP are 24-bit, which makes editing them easy (no need to worry about
keeping an ‘original’ 24-bit copy around for editing, and then converting it
to 8-bit GIF’s every time).

As for doing transparency, I always use 100% white for my “see through” color.
I don’t do any alpha blending yet (my games run slow enough as it is :slight_smile: ),
so it’s fine. (No need for something with an alpha channel, like TIFF.)

-bill!

“Nathan A. Yawn” wrote:

    Anyway, my question may be more philosophical than technical, but here

goes: What is the preferred image format for games (like this one)?
When I started writing, I used GIF, because that and BMP were the only
SDL-supported choices at the time. Would I be better off with another
format? (Will Unisys lawyers care if I release the game using GIF?)
What do you suggest, what are other people here using, and why?

Yes, UNiSYS will give you hell for it, if you used a program that was
developed without paying licenses to them for use of their patents. If
you have Photoshop, you may be safe (but don’t count on it, those slimy
bastards just got greedy), but if you used the Gimp…ah. Also is
hampered by lack of support for true color images. BMP is fine. There
are no legal minefields there, despite it coming from a company which we
guys in the know have come to hate. The only problem with it is that it
has no support for a lot of useful things you might find in other
formats, like transparency, various sorts of compression, and so on.
The TIF format is arguably the most flexible, but it’s an unholy monster
with too many options and lots of stuff in it that most people
developing games won’t need (file size of stock Red Hat 6.1 RPM
libtiff.so.3.4 is 393489 bytes compared to only 127526 for
libpng.so.2.1.0). So IMO, the best format for game graphics as of now
is PNG. It’s got support for every color depth imaginable, supports
full alpha-channel transparency (as opposed to the single color
transparency available with GIF), and has support for a wide variety of
compression schemes, from RLE to LZ77 (which don’t have patents, both
available with zlib). It’s surprising that, as of today, none of the
serious web browsers actually support it properly. Netscape is
incapable of handling PNG transparency correctly; hopefully this will
change in the 5.0 release…–

| Rafael R. Sevilla @Rafael_R_Sevilla |
| Instrumentation, Robotics, and Control Laboratory |

College of Engineering, University of the Philippines, Diliman