forums

TNT Basic Forums > Beyond Basic
Compression
< Last Thread     Next Thread >
Author
Thread        Post A Reply

12-12-2001 14:37

Posted by:
Socrates

Find more posts by Socrates

I recently downloaded Ambrosia's excellent new game Deimos Rising, and was browsing through it's files to see if I could gain insight into it's graphics, etc.

The game stores it's resources in .pak files, which turned out to be zipit documents. If you unzip them you find that they contain standard music and grphics formats (the graphics are in TGA format, which I've never heard of, but fortunately Photoshop has).

I was interested to note that the maps are now single giant images instead of tiles as they were in the original. They're beautiful, but very large...

...which brings me to the point of this post. I was wondering if TNT uses compression for its resources. It makes sense to make games that use single-image maps in these days of copious memory, but hard disk space is always at a premium.

So what form does TNT store graphics, etc in, and does it compress them at all? Also, does it load resources on the fly as they are used, or all at once? I have a lot of ram on my machine, but I still wouldn't want to have to load all the maps from a game like deimos into memory at the same time, so how does TNT handle this issue?

12-12-2001 15:41

Posted by:
ChrisD

Find more posts by ChrisD

1. There are free zip and unzip libs out there
TNT could use.. Im not sure but zlib might be zib compatible also...

2. Actually HD space is REALLY cheap these days.

3. I wrote code a while back for

http://www.desoftware.com/

This was threaded back ground reading of REALLY
large PNG files.

But this was in no way a genral solution to this type or problem.

4. I think rendering solid back grounds a stupid waste...
Why... you can make a game using tiles that looks just as good as DR.

Also I don' think DR back grounds are that detailed for the most part they look easily tilible.

Also tiles save RAM and disk space.
Also tiles give you more flexibility.
Examples you can animate any ground tile...
like animate the water... Raiden does this
I saw nothing like it in DR...

Also you could make multiple layers of tiles...
aka parallax... you would not want to make multiple
layers of giant back gorunds.

Just some thoughts












12-12-2001 15:51

Posted by:
Mark Tully

Find more posts by Mark Tully

Compression

I agree on the need for compression and Chris is right about zlib being available. Incidentally, it's now a standard component of quicktime so you can use quicktime to compress/decompress data blocks - handy.

As for what compression we use, we're actually quite good. Graphics are stored in the resource in whatever format they're imported in, so you should compress your graphics before hand as (JPEGS, GIFS, TIFF, BMP, PICT whatever) and then import them.

Sounds are done similarly, compress before you import and TB retains the compression settings. You can import mp3, aiff, aiff-c, qdesign and all that -law and other stuff.

Music makes use of MAD1 compression that is built into MADLib (by Antoine Rosset). Think it's just run compression for the music patterns.

The banks for images/sounds are just arrays of bytes so are pretty small (<100 bytes on average). We don't compress them.

Maps aren't generally that big either, again just an array of numbers. I guess we could compress them for a few bytes but it's really not worth it.

As for loading, resources are loaded as needed. Most are loaded explictly, eg load TNT Map, load sound bank, load image bank. They've all got associated unload commands too, so you can manage your memory if you need to.

Pictures are loaded as they are drawn and then disposed, so if you want to draw it many times you're best rendering it to an offscreen canvas for quick access later. you'll get a performance hit otherwise, especially with JPEGS.

Hope this answers some of your questions!

Mark

12-12-2001 19:18

Posted by:
Socrates

Find more posts by Socrates

External files

I think it's a bit harsh to say the DR's graphics could easily be done with tiles. They have a number of features like shadows, varied foliage, arbitrarily angled bridges and pixel accurate (almost) media detection (it knows if your bullet landed in water, etc) that would all be tricky with tiles. Also, while it may not be the most varied landscape imaginable, there is potential to use much better renderings, or even photographs as the backdrop for games by doing it this way. Certainly it is nice to have a game where there aren't obvious joins and repetitive patterns like most of the scrolling shooters out there.

Secondly, hard disk space is at a premium. It may be very cheap to buy external hard disks, but I have a powerbook, and an external disk is a hassle, even if it's a bus powered firewire device (and they AREN'T cheap anyway). Many games actually choose to solve this problem by leaving the graphics files on a CD...

...so how about it TNT developers? why not include the option for graphics/music resources to be stored in a seperate file. It would allow the more sizeable games to save disk space. It would also be nice to be able to load external graphics/music anyway, as many games let you listen to the tunes of your choice while playing, and even to customise the graphics with plugins/etc (In theory this could be done currently with a text file by copying it a byte at a time to pixels in a canvas, but that would be a tad perverse).

12-13-2001 07:26

Posted by:
Chris D

Find more posts by Chris D

>>>>
I think it's a bit harsh to say the DR's graphics could easily be done with tiles. They have a number of features like shadows, varied foliage, arbitrarily angled bridges and pixel accurate (almost) media detection (it knows if your bullet landed in water, etc) that would all be tricky with tiles
<<<<<

Shadows could be done with alpha channels as parts of a tile... This would color tiles next to it.

varied foliage can be done with creative use of tiles.

arbitrarily angled bridges could be bigger tiles.
tiles could be of any shape or size includeing irregular shapes.

Pixel accurate detection of water etc can be done a number of ways... includeing simply looking for a range of colors or by having meta date is a tile that says that a sprite is water. It is a simple and pixel level hit detection.

As a good example look at old SNES style games
some are almost perfect.

But basically the biggest point is that with giant backgrounds you simply lose flexibility or animating separate tiles and other tile effects.

BTW Im not too impressed by DR at all
I think MR was a much better game.
DR does not compare to what is out on the PC right now...

See
http://www.smallrockets.com/pc/starmonkey/index.htm

for a great game mades it a 3D engine and tiles
that blows anything on the mac out of the water.

This what people should be shooting for...











All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.