suggestion: file compression

Started by dasjoe, Sun 11/04/2004 01:40:43

Previous topic - Next topic

dasjoe

'lo.

it came to my mind some days ago, but then i forgot about it again.
but this thread magically brought the thought back.

is there a way to give the engine the capability to compress/decompress files using tar and gzip? and does the license of gzip and tar allow that?

i've looked into a 1,2mb savegame using a hexeditor. pretty much 01 and 00 in there. then i  compressed it with winrar, resulting file was 4 kb.  (i know, rar is not tar.gz ;))

so i think it would be a good idea to compress the savegames and/or datafiles directly with the engine.
thanks for your patience
... it's quite easy being the best.

Robert Eric

I think it already compresses files.  Just check changes.txt in the docs directory of AGS.  If not, I can't imagine why Chris didn't put in such an important feature after all these years.
Ã, Ã, 

faggc

#2
Maybe we could also compress some resources (the sprites). I know that it is not made to allow the games to run on older computers. But this could be implemented as an option to the creator.

dasjoe

i've just read the changes.txt, it says something about an upgraded compression algorithm for the room files. so i guess the whole datafiles are compressed by default.

but compressing the savegames would be nice (for the ones for whom filesize matters). and they should be highly compressible.
... it's quite easy being the best.

Pumaman

Save games and sprites are not compressed for performance reasons -- so that save games load instantly, and because sprites are constantly loaded from disk throughout the game, compressing them would have an unwelcome performance hit.

Besides, with today's 80 GB hard drives, is a 1 MB save game file really a problem?

faggc

Quote from: Pumaman on Sun 11/04/2004 22:06:23
Save games and sprites are not compressed for performance reasons -- so that save games load instantly, and because sprites are constantly loaded from disk throughout the game, compressing them would have an unwelcome performance hit.

Besides, with today's 80 GB hard drives, is a 1 MB save game file really a problem?


And if the sprites were stored in pcx (or other) format. Would this afect too much the performance?

Hollister Man

Well, you could probably (depending on your system) set up a program or your OS to make a compressed Disk Image, and run your game from there.  That way the whole shebang is compressed.  I KNOW OS X of mac can do that, but can't run AGS.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

Pumaman

Quote from: faggc on Mon 12/04/2004 12:46:37
And if the sprites were stored in pcx (or other) format. Would this afect too much the performance?

I'm not sure, I haven't really tried. But it's not something that I see as a big problem, so it's not planned to be changed any time soon.

Ryukage

Quote from: Pumaman on Mon 12/04/2004 18:18:35
Quote from: faggc on Mon 12/04/2004 12:46:37
And if the sprites were stored in pcx (or other) format. Would this afect too much the performance?

I'm not sure, I haven't really tried. But it's not something that I see as a big problem, so it's not planned to be changed any time soon.

If you do ever feel like changing it, take a look at the existing support for run-length encoded sprites in Allegro.  RLE provides only minimal compression, but can be written directly to the screen without decompressing, so it if anything it will improve performance -- uses less memory and writes whole runs of pixels at once instead of one pixel at a time.  And even as minimal as RLE is, it tends to work very well on game sprites because of all the large blocks of solid color.
Ninja Master Ryukage
"Flipping out and kicking off heads since 1996"

Gilbert

I think RLE may help (PCX uses RLE), but may not work out good for sprites with large variations of colours (eg. gradient filled hicolour sprites, photorealistic sprites, etc.). I still think it's worth a try adding RLE compression on sprites as it probably don't affect much on performance and should help in reducing game sizes in most cases.

Radiant

It would help on any sprite with significant areas of transparency.
Certainly it would help on the hotspot/region/walkable bitmaps that I assume are stored in room data files.

Pumaman

I have looked into allegro's RLE sprites briefly, but it doesnt look like they'd be very easy to integrate into the engine. More importantly, they would probably slow things down where you have highly varied sprite colours.

The hotspot/region/walkable masks are already compressed in the room files along with the room backgrounds.

Gilbert

Hmmm can it be coded so that upon importing a sprite:

[Crappy pseudo code]
RLESprite=RLECompress(Sprite);
if (Size(RLESprite)>=Size(Sprite)) Store(Sprite);
else Store(RLESPrite);
[/Crappy pseudo code]

But then I think it's probably not worth the effort and the currently implementation is fine already.

Pumaman

Yeah, possibly - but as you say, it's really not worth the hassle.

SMF spam blocked by CleanTalk