Sorry for the slow reply, been out of the loop for a little bit... (I hate it when work interferes with my hobbies!!)
The maze is hard coded in an octal-encoded string, so for example the simple level is:
String sMapData = "\001\001\055\260" + "\010\001\060\265\377\201\201\236\372\255\201";
The first number is the number of walls in each "wall chain", then the x and the y coordinate of the wall starting point. After that, there's either pairs of x,y coordinates (one byte each) or if the high bit is set then the wall is perpindicular to the last wall (or vertical, if it's the first wall)
So the first few walls on the second chain here ("\010\001\060\265\377\201\201\236\372\255\201") are:
- there are \010 (ie
walls in this chain
- the first wall starts at (\001, \060) ie (1, 48)
- the next number (\265) has it's high bit set on the first wall so it's a vertical wall, and we'll ignore the high bit, so the wall ends at \065 ie 53. Thus the first wall goes from (1, 48) to (1,53)
- the next number (\377) again has the high bit set, so it's perpendicular to the last wall (ie horizontal) and ends at (177) ie 127. Thus the second wall goes from (1,53) to (127,53)
And so on. This constrains my walls to be in the range (1, 1) to (127,127) but it means I get to effectively use one byte per wall, unless I want a diagonal wall in which case I need to give both x and y coordinates.
Aren't you glad you asked?
I'm happy to release the source code if anyone's interested, but it's rather a mess due to the optimisations...
Thanks for the comments though, it's much appreciated. I wanted to see what kind of cool graphics I could stuff into 4k, and I'm aware that it does tax the CPU a little, particularly at some of the harder levels when there are a bunch more monsters and sprites. I think even moderately high spec'd machines would grind a bit on level 4, but without many more bytes, the only way I could have sped it up would be by reducing the screen size, and that would have been a shame...
I really wanted to put in a gun image on the screen which would have helped with the aiming, but I had exactly 1 byte to spare after my best optimisation attempts, so it went by the wayside. As did the mini-map...