A simple "hack" to save memory would be to use ints
and treat them as a byte array[2] using byte masks and bit logic.
That's usually not worth the pain. The additional logic, wich is required, eats some bytes too and compression ratio can turn from "awesome" into "not exsistent".
For example... I had a level file like that:
1 2 3
| 11111111111111111111 10000000000000000001 10000000000000000001 10000000000000000001 10000000000000000001 10000000000000000001 10000000000000000001 10000000000000000001 10000000000000000001 [values ranging from 0-7] [...] |
6300 bytes in size... it compresses down to 638 bytes. The same binary encoded (with 3 or 4 bits) wouldn't be significantly smaller after compression and the overall size (together with the required logic to decode it) will be slightly bigger than before.
Alot of work and it doesnt even save a single byte... also it took even longer to load lol
