Actually the compression is pretty simple. You are right that 3 bytes does equal 8 tiles, but as it works, 3 bits is for one tile, and it's the tile Id. From 000 to 111, you get exactly 8 tile ID's. To make it easier to encode, start from the rightmost byte. Let's say that you wanted to make 8 tiles full of ladders, which is tile ID 01. Start at the right, and start with 00000001(which is 01). To make the next tile to the left the same ID, find in the bits where the next group of 3 start, keeping in mind that the game reads bits from right to left. That would make it 00001001, which is 09. To make the NEXT tile the same Id, find the next 3 bits. That makes it 01001001, which is 49. The next byte to the left keeps the same pattern, minding of course that since the entire thing is read as a series of 24 bits, not 3 separate bytes, the next byte will assume the sequence of bits is carried over. That means to make the next set of tiles all ladders, you need 10010010, which you notice that if you continued to the right you would get the same value as the third byte. The last byte continues the same pattern. basically you end up with 00100100 10010010 01001001. So to get the tile ID's you want, you start from the right, assign each 3 byte sequence a value from 000 to 111(00 to 07) and just repeat keeping in mind you are assigning bits, not bytes.