Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm writing a game that needs to save a lot of detailed data (exact trajectories of some entities) to an external file. I want to save drive space and bandwidth by compressing it, but I've never done this, so I don't know if there is a preferred way to do it.

Of course the compression-decompression should not affect the speed of the game too much.

share|improve this question
1  
What language are you using? –  Richard Marskell - Drackir Aug 31 '11 at 11:35
add comment

2 Answers 2

up vote 8 down vote accepted

The zlib library has bindings for most programming languages, and is quite fast. However, you should compare various comperssion algorithms, because one algorithm may achieve better compression rates on your kind of data than on the general case.

share|improve this answer
add comment

One, possibly extreme way of compressing data is to record only the steps/inputs used to create it. Something like what ModNation Racer does (curse those long loading times as it re-creates the track). (Google for videos of the track editor in ModNation Racer).

i.e. if i was storing some terrain, i'd store all the manipulations starting from a flat plain. i.e. apply the volcano shaped brush with this force, here. Apply the terrain smoothing operation over this area, with this force. Add my predefined object here. Using bezier-curve-like curves with 'key-frames' to construct an entire track/flight path/whatever.

Many other games do this sort of thing not just for level loading, but for gameplay too, by making the game deterministic, sending only player inputs (i think PixelJunk Shooter 2 does this).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.