11 March 2013, 00:31 | #1 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Best Compression Methods For...
Hi,
I know there are a few different compression methods (e.g. LZ77, LZW, RLE and Huffman encoding), but is there a general guide to which compression method is best (and not bound by copyright/licensing laws)? I'm in the middle of making a game and the raw graphics data (so far) is 32KB in size, but storing it in .IFF format reduces it to around 15KB and using .PNG format it is 9KB! I'm thinking that .PNG is best. Does anyone know which methods were used in the past to compress game data? Does anyone even bother compressing game data these days when making new Amiga games?? |
11 March 2013, 08:38 | #2 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
I presume, if you're storing your graphics in .png format, that you then have to have a routine to convert those graphics into raw bitplane data ready for display?
Why not just use raw data to start with and crunch it with a data cruncher prior to storing? Then just uncrunch the data as necessary as and when you load it. |
11 March 2013, 10:21 | #3 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,767
|
Depends on your target storage method. If you have a lot of data and want the game to run of floppies, then you'll probably need compression. If floppies aren't supported, then I probably wouldn't bother because of todays large HD's.
|
11 March 2013, 11:30 | #4 |
Registered User
Join Date: Jan 2013
Location: Lexington VA
Posts: 94
|
well, if its .IFF its probably ILBM or if its from the PC side, its PBM, they are just run length compression. PNG uses zlib/pkzip DEFLATE internally.. which is LZ77 + Huffman combined. it is not covered by active patents.
|
11 March 2013, 15:00 | #5 | ||
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Quote:
Quote:
(for use inside my ASM programs). NB: I didn't know until recently that Personal Paint code decode .PNG files Thanks for the info |
||
11 March 2013, 19:11 | #6 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
I use a lot of compression in my code. My main port of call is a variant of LZSS with variable length offset fields.
For my graphics I started using AMOS's graphics compression command "spack", which does quite well when saved using powerpacker library ("ppsave"/"ppload" instructions from the AMOS Compiler extension). However I replaced powerpacker with my own routine later on. I'm still using the AMOS bank format for some of the graphics (the asm source code is available), but for tiles and bobs I do RLE, and everything followed by LZSS. When compressing audio sample data, it is beneficial to "differentiate" the sample first. That is, store the bytewise difference between each sample and the next. This typically results in a narrower range of values. I haven't touched Huffman yet although I'd like to. Also look up Range coding - might be a bit much for an Amiga but it's quite interesting. |
16 March 2013, 23:05 | #7 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Thanks for the tips, Mrs Beanbag
|
18 April 2013, 11:13 | #8 | |
Registered User
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 187
|
Quote:
|
|
18 April 2013, 16:07 | #9 |
Registered User
Join Date: Aug 2008
Location: Göteborg / Sweden
Posts: 237
|
Hmm, I have a compression method I developed for the C64 that should port over quite easily. I wrote test unpacker in AmigaE as a proof of concept:
Code:
PROC backunpack(indata:PTR TO CHAR, inlen:LONG, outdata:PTR TO CHAR) DEF inpos = 0 DEF outpos = 0 DEF backpos DEF c DEF l WHILE inpos < inlen c := indata[inpos++] SELECT 256 OF c CASE 0 RETURN outpos CASE $80 TO $ff l := c - 127 REPEAT outdata[outpos++] := indata[inpos++] DEC l UNTIL l = 0 DEFAULT l := c + 2 backpos := outpos - 256 + indata[inpos++] REPEAT outdata[outpos++] := outdata[backpos++] DEC l UNTIL l = 0 ENDSELECT ENDWHILE ENDPROC |
18 April 2013, 21:38 | #10 |
Registered User
Join Date: Jul 2014
Location: Warsaw/Poland
Posts: 187
|
MagerValp it looks like RLE compression
|
18 April 2013, 22:01 | #11 |
Registered User
Join Date: Aug 2008
Location: Göteborg / Sweden
Posts: 237
|
No, it does repeating patterns, its closest ancestor is LZSS.
|
18 April 2013, 22:20 | #12 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
|
18 April 2013, 23:13 | #13 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
20 April 2013, 22:22 | #14 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Thanks, Stingray.
|
15 June 2013, 18:12 | #15 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,604
|
Do the gfx come from an Amiga or a PC paint program? How many colors are we talking? What is the average width/height of the image files?
If you're not cramped for memory, I recommend to just save in the best format available in the paint program and load it as that format. Speeds up development by skipping the conversion and compression steps. |
15 June 2013, 22:59 | #16 | |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Quote:
I'm considering using a CGI image for the title screen, and possibly making use of the super-hires mode. I already have some polygon corridors and towers created using Wings 3D (again, on my laptop), which I made last year for fun I already have working code to inflate .PNG files in AMOS Basic, and am slowly converting it to ASM |
|
16 June 2013, 17:31 | #17 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,604
|
Then you're set I'd say So unless you absolutely must do some cutting or editing on the Amiga end, it would be unnecessary to convert them to iff or add special compression or something like that.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Methods for removing labels from floppies | diablothe2nd | support.Other | 22 | 08 July 2013 21:43 |
Compression Suggestions | h0ffman | Coders. General | 2 | 31 December 2010 12:19 |
A600 case trimming - tools/methods | mancalledSun | Hardware mods | 2 | 26 March 2010 04:26 |
Data compression History | DH | Nostalgia & memories | 21 | 23 October 2008 13:18 |
|
|