Image File Grouping

I was wondering how most people deal with using multiple pictures in their
games.

For example: if you have a sprite animation (your character in your game)
with say 20 frames of animation in bmps or pngs…

How do you group all those files together so you don’t load them
individually?

Do you make some sort of datafile?

Plus I’d want to store wav files… and any other junk.
I guess it would just be like a WAD file right?

Does SDL already support some kind of datafile for grouping files?

Ideas?______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

For example: if you have a sprite animation (your character in your game)
with say 20 frames of animation in bmps or pngs…
How do you group all those files together so you don’t load them
individually?
Do you make some sort of datafile?
I am rendering these short animations directly into a photoshop file, where
I still can use the antialiased edges with the alpha channel. The layer feature
allows to group them into one file, keeping them still editable. This thing alone
made the effort to write a photoshop reader worth ;-).

Regards,
Andreas Podgurski

I am rendering these short animations directly into a photoshop file, where
I still can use the antialiased edges with the alpha channel. The layer feature
allows to group them into one file, keeping them still editable. This thing alone
made the effort to write a photoshop reader worth ;-).

Interested in adding an SDL_image loader for Photoshop files? :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

You could group each “animation” as a vertical “strip” of images, that way
you only load one file?

Also, for using a single data file, perhaps you could look into zlib?
http://www.info-zip.org/pub/infozip/zlib/--

Olivier A. Dagenais - Software Architect and Developer

“Dwight Follick” wrote in message
news:385186679.981675402174.JavaMail.root at web628-mc…

I was wondering how most people deal with using multiple pictures in their
games.

For example: if you have a sprite animation (your character in your game)
with say 20 frames of animation in bmps or pngs…

How do you group all those files together so you don’t load them
individually?

Do you make some sort of datafile?

Plus I’d want to store wav files… and any other junk.
I guess it would just be like a WAD file right?

Does SDL already support some kind of datafile for grouping files?

Ideas?


FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

For example: if you have a sprite animation (your character in your game)
with say 20 frames of animation in bmps or pngs…
How do you group all those files together so you don’t load them
individually?
Do you make some sort of datafile?
I am rendering these short animations directly into a photoshop file, where
I still can use the antialiased edges with the alpha channel. The layer feature
allows to group them into one file, keeping them still editable. This thing alone
made the effort to write a photoshop reader worth ;-).

Hrm… I would’ve just saved the frames as a PNG. Do it as separate
files (which it sounds like people don’t like) or as one big file
(then grab blits from within it as needed).

With PNG, you still get 8bit alpha channel… you can even do indexed
palette and still have alpha… or indexed alpha channel… or… :slight_smile:

-bill!

At 01:33 9/02/01 +0100, Andreas Podgurski wrote:

I am rendering these short animations directly into a photoshop file, where
I still can use the antialiased edges with the alpha channel. The layer
feature
allows to group them into one file, keeping them still editable.

Can you have multiple alpha channels? If so, how are you associating
each image or layer with a particular alpha channel? If not, how are you
getting different alphas for each image?

I was wondering how most people deal with using multiple pictures
in their games.

For example: if you have a sprite animation (your character in your
game) with say 20 frames of animation in bmps or pngs…

I usually store my graphics as “tile maps” (tiles, sprites, fonts,
everything…), which are basically just plain images of any size
with all frames aligned after a grid. The only problem is that the
game has to know the tile size for each image, but that’s been a
minor problem for the tiny projects I’ve done so far. One could
reserve the first tile for an outline that defines the tile size or
some other graphics artist friendly hack… (Nowadays we generally
don’t have to worry much about 8/16/32 pixel alignment, so that could
work just as well as it appears.)

How do you group all those files together so you don’t load them
individually?

Do you make some sort of datafile?

No, not so far. Only had a few dozens of files to deal with, though…

(Speaking of which, I’d really like to port that Project Spitfire
game to SDL, just to get started with something fun. But first MAIA,
then the Utah-GLX retrace sync, and then some audio hacks to
demonstrate MAIA, and then that Generic 2D Game Graphics Engine,
and… Any century now! :slight_smile:

Plus I’d want to store wav files… and any other junk.
I guess it would just be like a WAD file right?

Could throw it in a *.(tar(|.gz|.bz2)|zip) and then use standard
libraries to dig out the files.

Does SDL already support some kind of datafile for grouping files?

Not that I know of, but there seems to be a way to hook it in behind
the SDL file access API. Someone that actually looked into it should
answer that! :slight_smile:

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Friday 09 February 2001 00:36, Dwight Follick wrote:

AFAIK, both PhotoShop and GIMP gives each layer (including the
background layer) a full set of channels, including the alpha channel.

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Friday 09 February 2001 03:08, Damian Lettie wrote:

At 01:33 9/02/01 +0100, Andreas Podgurski wrote:

I am rendering these short animations directly into a photoshop
file, where I still can use the antialiased edges with the alpha
channel. The layer feature
allows to group them into one file, keeping them still editable.

Can you have multiple alpha channels? If so, how are you
associating each image or layer with a particular alpha channel?
If not, how are you getting different alphas for each image?

Can you have multiple alpha channels? If so, how are you
associating each image or layer with a particular alpha channel?
If not, how are you getting different alphas for each image?
AFAIK, both PhotoShop and GIMP gives each layer (including the
background layer) a full set of channels, including the alpha channel.

What’s going to be behind the background layer, that will show
transparency??? :)–

Olivier A. Dagenais - Software Architect and Developer

Interested in adding an SDL_image loader for Photoshop files? :slight_smile:

this can be done at a cost of a more complicated SDL_image api (which
should be able to accommodate Gimp’s .xcf format, multiframe gif/tiff etc)
However I think it’s better if people stay with standard image formats
for several reasons. I haven’t understood people’s irrational fear of
using separate files and directories for their images

I agree it’s nice to be able to edit all frames of an animation at once
but Gimp has ways to split/gather layers to/from separate files and
I assume Photoshop has them too (if nothing else it sounds like a
trivial application of applescript or whatever photoshop uses)

I am rendering these short animations directly into a photoshop file, where
I still can use the antialiased edges with the alpha channel. The layer
feature
allows to group them into one file, keeping them still editable.
Can you have multiple alpha channels? If so, how are you associating
each image or layer with a particular alpha channel? If not, how are you
getting different alphas for each image?
Each layer has a transparent channel (to contrast it from these alpha
channels, which are “only” masks in photoshop) so each layer is a full
32bit bitmap.
The big advantage is, that every layer may be compressed or not. It is
possible to have half the layers compressed while the other half is not
compressed, because they are breaking the uncompressed size (I mean,
compressing is not worth).
Concerning a loader for SDLimage, I have to say that I never used SDLimage,
but I believe it wouldn’t fit in the calling scheme (Correct me, if I am wrong). I
am using this call:

Uint32 SDLTK_LoadPSD(SDL_Surface **srfc,Uint32 maxlayers,Uint32 layers,char *filename);

Where the surface double pointer leads to an array of uninitialized surface
pointers with maxlayers elements, while layers is a 32bit bitmask with up to 31
layers (If set, the layer is loaded) and the compound layer at bit 0.
The other thing is that the loader is a side product of a commercial plug in for
realsoft 3d, so I still have to ask for the permission to make the old code public
available. If so, I think I’m going to release a preview of my toolkit library, which
contains some other nice stuff, like a scripting language, an advanced motion
jpeg codec with subtitles, thumbnails and user encoded information, a simple
gui library and much more. But this will take at least till summer, because I am
bussy with my diploma.

Regards,
Andreas Podgurski

Can you have multiple alpha channels? If so, how are you
associating each image or layer with a particular alpha channel?
If not, how are you getting different alphas for each image?
AFAIK, both PhotoShop and GIMP gives each layer (including the
background layer) a full set of channels, including the alpha channel.
What’s going to be behind the background layer, that will show
transparency??? :slight_smile:
Two choices: The background layer is fully unopaque and fills the target
area completly or it is opaque, then this area is transparent for the target
area. You can do nice shadows and stuff with this :-).

Regards,
Andreas Podgurski

P.S.: This list reacts really slow, is it possible to increase feedback speed
a bit?

> > Plus I'd want to store wav files... and any other junk. > > I guess it would just be like a WAD file right? > > Could throw it in a *.(tar(|.gz|.bz2)|zip) and then use standard > libraries to dig out the files. > > > > Does SDL already support some kind of datafile for grouping files? > > Not that I know of, but there seems to be a way to hook it in behind > the SDL file access API. Someone that actually looked into it should > answer that! :-)

I wrote a quick wrapper for zziplib (http://zziplib.sourceforge.net/) to use
it as a SDL_RWops. Of course, I had to write seeking code for the library
first, so that still needs some work, but it does the job. If you want to
try it out, you’ll need to go download zziplib 0.10.13 from the address
above, and you’ll also need zlib. You can then get my code from
http://www.perilith.com/~luser/sdl_zip.zip

Let me know if you find this useful,
-Ted

----- Original Message -----
From: david@gardena.net (David Olofson)
To:
Sent: Thursday, February 08, 2001 10:28 PM
Subject: Re: [SDL] Image File Grouping

for several reasons. I haven’t understood people’s irrational fear of
using separate files and directories for their images
I believe you have never been involved in a major project containing
thousands of single graphics. First, the runtime is very slow. To load
a file you have to open and close these files, that is really time consuming.
Second, you loose, depending on the file system, heavy disk space, if
the images are small. Third point is that it is a real terror to keep such a
library valid. Last but not least, if a already have these images in a library,
why break it? THAT is irrational.
Trust me, I WAS involved in such projects and there was ALWAYS the
time to concentrate the organisation. The best solution at all really is
storing the files in a searchable database!

Regards,
Andreas Podgurski

Can you have multiple alpha channels? If so, how are you
associating each image or layer with a particular alpha channel?
If not, how are you getting different alphas for each image?
AFAIK, both PhotoShop and GIMP gives each layer (including the
background layer) a full set of channels, including the alpha channel.

What’s going to be behind the background layer, that will show
transparency??? :slight_smile:

In Gimp, you see a checkerboard (you can set its color and the size
of the squares in the settings dialog).

The point is, if the background has an alpha channel, you can use the
image as a sprite in a game, as a better alternative to GIFs (use PNG!),
etc.

-bill!

this can be done at a cost of a more complicated SDL_image api (which
should be able to accommodate Gimp’s .xcf format, multiframe gif/tiff etc)
However I think it’s better if people stay with standard image formats
for several reasons. I haven’t understood people’s irrational fear of
using separate files and directories for their images

YAY! I’m rational! Whee! :slight_smile:

Actually, it’s just cool to be able to have a shell script with a loop
in it that calls POVRay to generate different angles of a sprite, saving
them to different files.

If I REALLY wanted to combine them afterwards, I could always use the
NetPBM libs (or maybe GD) to stick them all together into a big single
file.

-bill!

Interested in adding an SDL_image loader for Photoshop files? :slight_smile:

this can be done at a cost of a more complicated SDL_image api (which
should be able to accommodate Gimp’s .xcf format, multiframe gif/tiff etc)

Aditional stuff to deal with the layers?

However I think it’s better if people stay with standard image formats
for several reasons.

If nothing else, they generally compress a lot better than the application
native formats - and don’t contain lots of extra info.

I haven’t understood people’s irrational fear of
using separate files and directories for their images

Good point. Most applications install countless files in a bunch of
subdirectories, so why should a game stay in one or two files? We do have
directories and a bunch of different archive management tools these days. :slight_smile:

The only reason I can see is to make reverse engineering harder - but then
you have to hack it all yourself, and deliberately making it as non-standard
and obscure as you can. You’d hardly use a mainstream SDL extension library
in that situation… :wink:

I agree it’s nice to be able to edit all frames of an animation at once
but Gimp has ways to split/gather layers to/from separate files and
I assume Photoshop has them too (if nothing else it sounds like a
trivial application of applescript or whatever photoshop uses)

Only the latest versions of PS has scripting at all - and AFAIK, even old
GIMP versions still makes it ridicoulus… Don’t know if they’re aware of
anything but the most basic operations.

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Friday 09 February 2001 14:42, Mattias Engdeg?rd wrote:

Using “tile maps” rather than individual frames cuts the number of files
significantly, but still, some sort of database or at least an "image bank"
style file format would be handy… It should be possible to write some GIMP
and/or PhotoShop plugins to deal with it nicely. (Import/export as layers or
tile maps etc.)

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Friday 09 February 2001 16:36, Andreas Podgurski wrote:

for several reasons. I haven’t understood people’s irrational fear of
using separate files and directories for their images

I believe you have never been involved in a major project containing
thousands of single graphics. First, the runtime is very slow. To load
a file you have to open and close these files, that is really time
consuming. Second, you loose, depending on the file system, heavy disk
space, if the images are small. Third point is that it is a real terror to
keep such a library valid. Last but not least, if a already have these
images in a library, why break it? THAT is irrational.
Trust me, I WAS involved in such projects and there was ALWAYS the
time to concentrate the organisation. The best solution at all really is
storing the files in a searchable database!

just a quick mention:

MNG format == grouped PNG file format;
supposed to replace GIF/animated;
Also includes jpeg as well as PNG support in animations.

ftp://swrinde.nde.swri.edu/pub/mng/documents/

though FWIW I found out about this on the w3 website…
G

G’day, eh? :slight_smile:
- Teunis

I believe you have never been involved in a major project containing
thousands of single graphics. First, the runtime is very slow. To load
a file you have to open and close these files, that is really time consuming.

not necessarily with fast syscalls, file systems and aggressive caching/
read-ahead nowadays — I’m not using MS-DOS. I have used thousands of
single image files in projects with no ill effects, and the small
performance loss is more than offset by the gain in flexibility since I
can use standard tools to manipulate them. The programmer could then write
a wrapper that permits the program to access them in the same way even if
they are stored in collection files, should he be concerned about
performance

Second, you loose, depending on the file system, heavy disk space, if
the images are small.

disk space is considered cheap nowadays and even in a large project
the internal fragmentation will not exceed a couple of megs, and even
I can spare that amount when developing. (it may or may not be acceptable
for final delivery)

Third point is that it is a real terror to keep such a
library valid.

I’m not sure what you mean but it is in general a lot easier to keep
a file system valid since it is done by realiable kernel drivers, than
some kind of archive file

Last but not least, if a already have these images in a library,
why break it?

code is for solving problems, not imposing dogmas. No solution is
universal and none should be taken as such