Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Fast, non-viral compression ?  (Read 2540 times)
0 Members and 1 Guest are viewing this topic.
Offline abies

Senior Member





« Posted 2003-12-03 11:11:17 »

Does anybody know about any _fast_ and free (as in beer) compression/decompression code for java ? It does not have to be very good at compression, just do the basic stuff. LZO would be a perfect choice, but it is GPL-ed, so I have not even checked if there exists a java version of it...


Artur Biesiadowski
Offline Markus_Persson

JGO Wizard


Medals: 14
Projects: 19


Mojang Specifications


« Reply #1 - Posted 2003-12-03 11:30:48 »

java.util.zip.GZIPInputStream and java.util.zip.GZIPOutputStream?

Play Minecraft!
Offline AndersDahlberg

Junior Member





« Reply #2 - Posted 2003-12-03 12:28:35 »

Check out jsr-200 [ http://www.jcp.org/en/jsr/detail?id=200 ]

there you can find among others:
http://jarg.sourceforge.net/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline abies

Senior Member





« Reply #3 - Posted 2003-12-03 12:45:04 »

Anders - thanks for the links, but I'm have phrased myself not very clear - I'm looking for general compression algo, just implemented in java, not for something which compresses .class files.

Markus - yes, this is a fallback I'll will use if nothing else will appear, but I'm seriously worried about speed of it and setup cost. I want to compress/decompress small pieces of data (0.5-8kb) very frequently, so setup cost should be minimal - at the same time, algorithm does not have to be very smart, as there will probably be not so many chances for advances compression in such small blocks.

Artur Biesiadowski
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #4 - Posted 2003-12-03 13:03:29 »

What will your typical data look like?  What amount of compression are you looking for?

It is easy enough to code simple run-length compression.  Even adaptive Huffman codes would be manageable (I've done that in the past)


Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-12-03 14:04:12 »

Art, make it work first, then worry about making it fast if you have to later. It might not be very slow after all.

Would this be, perhaps, for network games communication?

Cas Smiley

Offline abies

Senior Member





« Reply #6 - Posted 2003-12-03 16:06:03 »

Yes, I'm thinking about game network communication. Reason why I would like to find a ready compression routine is exactly what you are talking about - to not have to worry about squeezing every bit out of message myself Smiley

BTW, if anybody would like a tester for his network code, I can apply - I have almost constant 15-20% packet loss on my connection, enough to make many of real time net games unplayable...

Artur Biesiadowski
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2003-12-03 16:37:33 »

Quote
I have almost constant 15-20% packet loss on my connection, enough to make many of real time net games unplayable...


Heheh.. and I consider Quake 3 unplayable with a ping over 10 and no loss Smiley.  Seriously twitch games over a net connection just don't work for me.. it takes all the fun out of the game when you are killed by shots that draw as complete misses, or your shots go through other players without counting.  (These things happen all the time in Q3 - sometimes even on a LAN)

There will be some compression done by analog modems already.  I don't know what is reasonable to expect for small amounts of data like you are using.   Compression is generally based on eliminating redundancy, or choosing more efficient code words like Huffman.   You could capture some typical data to see if there are any trends in a histogram off code words.  For example the values may all tend to be less than 15 because they represent changes between timestamps and things tend to not change by that much.. so encoding two values per byte with a special escape sequence for larger values could give you near 50% compression.   Look for trends in the data that you can exploit to see if there is a really simple solution.

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2003-12-03 17:17:01 »

Quote

I don't know what is reasonable to expect for small amounts of data like you are using.   Compression is generally based on eliminating redundancy, or choosing more efficient code words like Huffman.


You'll have to implement it yourself, from the example code provided, but...If you can get hold of the last couple of issues of GameDeveloper (gdmag.com IIRC) there's been a good series of articles about using "arithmetic coders" IIRC particularly for compressing network-protocol data (amongst other uses).

It might appear on gamasutra over the next couple of months, but it might not (I don't know how they decide what to publish for free on the site, but obviously they can't publish everything or no-one would read the mag. Or something like that...).

...or just Google for AC's and find out what they're about Smiley. But AFAICS reading the articles in GD would be easier.

malloc will be first against the wall when the revolution comes...
Offline abies

Senior Member





« Reply #9 - Posted 2003-12-04 07:22:08 »

Thanks for the link - althrough I'm not a subscriber, code is free to download at
http://gdmag.com/code.htm
I'll look into it and see if I'm able to understand anything without an article Smiley

Artur Biesiadowski
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!