Putting data in program memory on Arduboy

Hi, I'm making a game for the Arduboy and I have a question about storing things in program memory.

My game uses graphics stored as const char arrays. These are stored in program storage space using the PROGMEM keyword when declaring the arrays.

I also have a tile map array, which is a 3D array containing only 1s and 0s. The first dimension of the array is the level number, and the second two are the screen positions of tiles:

const unsigned char tileMap[2][8][16] = {
      { // Level 0:
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
      },
      { // Level 1:
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1},
        {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
      }
    };

I use this array to draw a tile wherever a 1 exists, and nothing where a 0 exists. This all works fine, but the problem is that I can only have three one-screen levels before pushing the 2.5k RAM limits of the Arduboy.

I figured that since the level map array is constant, it could be stored in the much larger program space. However when I use the PROGMEM keyword in my array declaration like this:

const unsigned char tileMap[2][8][16] PROGMEM = {...

The memory calculation shown by the compiler is no different than it was without the PROGMEM keyword. Am I doing something wrong?

Thanks!

I think I might have realised my error. I'm defining the array inside a class, and I guess that means it has to go into RAM.

I guess that means it has to go into RAM.

That doesn't mean that the array needs to use 8 times as much memory as needed. You are storing one bit in each byte. Store 8 bits in each byte and use 1/8th the memory.

PaulS:
That doesn't mean that the array needs to use 8 times as much memory as needed. You are storing one bit in each byte. Store 8 bits in each byte and use 1/8th the memory.

Hmm I hadn't thought of that. However I want to eventually have more than just 1s and 0s in each byte of my array, so I guess I should leave things as they are for now?

andylatham82:
Hmm I hadn't thought of that. However I want to eventually have more than just 1s and 0s in each byte of my array, so I guess I should leave things as they are for now?

so then, how can they be const?

BulldogLowell:
so then, how can they be const?

Well they are values set by me in designing a level and never change at runtime. Currently I have 1 for a solid tile and 0 for no tile. Eventually I want to have, say, 1 for a solid ground tile, 2 for a one-way platform tile, 3 for water, etc.