My proper introduction / Storing level data

Hi. Im been looking into the audroboy for quite a while, Im very interested in making a game for it.
I don’t know much about c++. I have been playing with different kinds of basics,and have dabble in Java, JavaScript, and python. But anyways,
Since the audroboy has little memory, what is the “best” as in smallest way possible to store level data? Maybe like a bool array or or unsigned 8 bit array? Or something else? Just looking at ideas for make the smallest way possible to store alot of data.

Team-arg has a couple of good write-ups on how they’ve shrunk level data on their website.

Here’s one for example

There’s also a lot of good articles on saving space in the arduboys magazine which you can find on this forum.


I not sure if that’s answer I was looking for. Those hex, how are you storing them? Via a unsigned short var? Or so and array? Again I really don’t know how to explain what im looking for that’s why my Google fu failed me…
Thx for the quick reply

It depends entirely on the kind of game being made.

For tile-based games it’s often best to try to squash more than one tile into a byte.
Tile-based games also tend to benefit from run length encoding.

In some cases you might be able to make a level generator that generates the whole level from a seed, in which case you may not even need to store any data.

If you’ve got a lot of boolean flags you can store each flag as a single bit.

As a rule of thumb though, I’d say write the game first and only start compressing when you actually need to.
Aside from the fact you might find that you don’t need to for quite a long time, it’s also a good opportunity to discover how your code responds to changing requirements.

Those would be in an array of uint8_t (or unsigned char - same difference), stored in progmem.

(If unsigned char confused you, read this. If uint8_t confused you, read this. If ‘same difference’ confused you, read this. If ‘progmem’ confused you, read this.)

1 Like