Grundo's Cafe
293 supporters
DOM II done... habi next πŸ›

DOM II done... habi next πŸ›

May 03, 2022

Destruct-O-Match II marks my ninth flash game I've converted and honestly it's been one of my favorites to work on so far. As of right now I only have normal mode working (no extreme or zen mode) but those will come when I get the motivation to commit some time to tech debt. I think I enjoyed working on this one so much because implementing the game logic was algorithmically interesting.

This month I was also doing a lot of Leetcode interview prep (😩). If you're not familiar - a lot of software developer job interviews involve asking a few coding puzzles. Find all the groups of anagrams in a list of strings, find the three numbers that sum to 0 in a list of integers, et cetera. It's painfully humbling and can be slog... so I was really pleasantly surprised to see a question that felt directly relevant to making DOM II!

Leetcode - 200 - Number of Islands

So the crux of this question is that we have a matrix of 1s and 0s. We want to find all the "islands" that consist of adjacent 1s. What's the most efficient way to do that?

In Destruct-O-Match II, we have a matrix of blocks of different colors (red, orange, green, etc.). When we click a block, we want all the adjacent blocks of the same color to highlight. After we clear those blocks, we want to find whether or not there are any remaining combos (dictates whether we end the level or we keep going). What's the most efficient way to do that?

It's practically the same question! The answer involves graph searching and keeping track of a 'visited' queue. I won't go into the weeds but it was a fun problem to solve!

As far as what comes next... feels very ambitious!

I think Habitarium will be a very large project. It's one that I've been thinking about doing since January 2021 when I tried learning Unity... at this point I did not know how to source art assets from Flash files 🀣

I learned a lot while using placeholder sprites, but I abandoned Unity in favor of PhaserJS later that year. To give an idea of the scale of the project... there is a single SWF file for Extreme Herder that contains 162 sprites. I've found nearly a dozen SWF files for Habitarium - the largest of which contains 2044 sprites. That, coupled with figuring out how to continually persist the game state (no save button, it's just always saving your progress in the background), will definitely take months.

But I'm motivated!

This plan is subject to change, but my short-term goal with Habitarium is to accomplish the following:

  • Petpetpets freely wander about the terrarium

  • Worker petpetpets can be assigned with a resource task

  • Resource count will go up as they complete this task

If I can accomplish that, I will be really optimistic about next steps. Adding the shop, the level system, nesters and fighters, etc...

Stay tuned and thanks for reading if you made it this far :)

Enjoy this post?

Buy Grundo's Cafe a coffee

More from Grundo's Cafe