Rob Northen compression

Rob Northen compression (RNC) is a data compression format. It was created in 1991 by Rob Northen. Many files used by Dungeon Keeper are compressed in this format.
== Technical Description ==
=== Header ===
A RNC-compressed file is prefixed by an 18-octet header containing information about the file:
=== Compression ===
==== Method 1 ====
This is the method used in RNC-compressed files in Dungeon Keeper. There is a bit stream, which is read from right to left as little endian 2-octet values, and a byte stream. Pack chunks contain three Huffman trees (one each for data sizes, distance values, and length values), each consisting of the number of leaf nodes (5 bits) and a bit depth (4 bits) for each node; the number of subchunks (16 bits); and the subchunk data, which contains byte stream literals and Huffman codes from the bit stream for the number of literals in the byte stream and the distances and lengths. 
==== Method 2 ====
Like the first method, there is a bit stream and a byte stream; however, here, the bit stream is read from left to right as single octets. There are no Huffman trees or subchunks, but a prefix coding. 
== Use in Dungeon Keeper ==
Many level files are compressed in RNC format. The game automatically decompresses them when they are loaded (though does not save the result to the disk), so the player need not worry about RNC when playing the game.
The dernc tool in the Dungeon Keeper Small Utilities suite and the DeRNC tool in the DKTools suite can be used to permanently decompress RNC-compressed files. The rnc tool in the former can be used to compress a file in RNC format; however, this does not work on all files.
== Use elsewhere ==
Bullfrog Productions is only one video game developer known for using RNC. Traveller's Tales is another. Many Sega Mega Drive games use RNC.
== External Links ==
*Rob Northen compression at Sega Retro