DEV Community

Justin Castilla
Justin Castilla

Posted on

Bitmaps! Bitmaps everywhere!

One of my favorite things about learning is the feeling of everything turning into a nail once you've acquired a new hammer. When I bought an Instant Pot smart pressure-cooker I cooked EVERYTHING in there - with mostly good results. When you're excited about a new concept or technology, you see the potential applications everywhere!

This giddiness hit me hard when I learned about Bitmaps. Bitmaps store information in a very compact and efficient way: with 1s and 0s. We can use these two states to represent the presence or absence of whatever we like.

In our Redis University Youtube Explainer series we use Bitmaps to store and retrieve partially-explored maps for an old-school RPG game called Mages & Minotaurs. I love how we are able to store seemingly large maps in a simple string of binary.

What's even more exciting is the potential for more information storage with Bitfields, Bitmap's big sibling. Bitfields are able to store values larger than binary (think octal and hex) and this gives us multiple flag options per position. The sky's the limit!

Top comments (0)