Resources for those interested in the Refpack/QFS compression algorithm used in many EA games. Also maintains links to known implementations of the compression for easy reference.
RefPack is a compression algorithm based on the LZ77/LZSS compression written by Frank Barchard for use in games made by EA. It can be found in games as early as FIFA International Soccer (1993). The algorithm uses different encoding schemes based on the length and position of the data that's being compressed, which allows it to achieve a higher compression ratio compared to other LZ-based algorithms.
The name QFS comes from a file format used in old Need for Speed games in which this algorithm was used. However, the actual name of the algorithm is RefPack.
Niotso Wiki: Generic information on the compression algorithm.
Explanation of The LZ77/LZSS Compression: Refpack is based on the LZ77 compression algorithm.
Explanation of zlib: zlib is a popular compression library and a lot of the techniques employed in zlib are utilized in Refpack compression code.
How to Compress: I try to explain the compression algorithm here.
List of known implementations of the compression algorithm organized by language and compression header for easy reference. A lot of those are rewrites of the same code in another programming language. The quality varies from one implementation to another.
Language | Header 1 | Header 2 | Header 3 |
---|---|---|---|
C | Denis Auroux | ||
C# | 0xC0000054 Venomalia rivit |
0xC0000054 Afr0 ambertation |
Venomalia pljones & Tiger gibbed |
C | benrg lingeringwillx |
OmniBlade KUDr J.M. Pescado |
|
Go | marcboudreau | ||
Java | java_dwarf | ||
JavaScript | sebamarynissen | ||
Kotlin | DarkAtra* | ||
PHP | Delphy* | ||
Python | lingeringwillx | lingeringwillx** lingeringwillx lah7 |
lingeringwillx |
Rust | actioninja | actioninja | |
Scala | memo33 |
*Decompression code only
**C Bindings