Matt vs Aliens

Meet Matt, our dog hero, who needs to stop the alien invaders from totally abducting all humans on the planet.
A long time ago, in a galaxy far, far away an alien world called Numbers was crumbling down and they set out to conquer new planets. Here comes Matt, the saviour of the world! Teach Matt how to add and subtract or else the aliens will be able to abduct all humans.
Highlights
- Designed and implemented two game modes: Timed Challenges, featuring an adaptive endless puzzle runner, and Grid Challenges, utilizing a structured level-based progression system.
- Made a level parser that reads a text file and maps the level in a grid procedurally.
- Deployed builds in Google Play weekly for the clients to review.
Features
The goal of the game reduce the anomalous tile to zero (0). Each time you complete an anomalous tile, you get points or complete a section of the challenge. Try the timed challenges or complete all the portal challenges to save the world!

Timed Challenges

Grid Challenges
The most fascinating part of this game for me was its clear intentions of becoming a brain training math game. This aligns with the company's values and vision of making the act of learning more accessible to kids. Visibly, this game trains players, mostly kids, basic subtraction and how different combinations of numbers can add up to that value.
Timed Challenge
Feature
Timed Challenge Mode was initially proposed as the primary feature of the game. It had simple features with a simple flow that were as follows:
- A 3x3 grid that with 1 central goal cell and 8 surrounding cells
- Each surrounding cell will reduce the value of the central goal cell by its value
- When the value of the central goal cell becomes 0 then a new central goal value will be randomly provided
- All selected surrounding cells will be refilled with a new value
- An endless runner with a timer continuously counting down to 0
- If the timer runs out or the value of the central goal cell becomes a negative value, then the player loses
The overall design of this game is to just be fast and reinforces the concept of basic arithmetic through rapid testing loops. The central goal number increases gradually which increases difficulty and challenges players to think quickly and do their arithmetic mentally.
Implementation
As for implementation, I managed to make it a procedurally generated endless runner by working backwards.
- So I started off by randomly generating a value from the central goal cell.
- Once I had its value, it's time to choose among the available slots randomly.
- Then I randomly chose a value from 1 up to the value of the central goal cell minus 1. This will value will go to the selected slot in Step 2. For example, if we have 5 as the central goal cell value, a value from 1 to 4 will be chosen at random.
- After getting that random value, I subtracted that value to the central goal cell value and took note of that current value. So in the example if I generated a value of 3 then I will take note of (5 - 3) which equals to 2.
- I proceeded to choosing another empty slot.
- Then generate a random value from 1 up to the current value we had in Step 4. Then take note of the current value. In the example, that would be from 1 to 2. If I got a 1 then I will take note of (2 - 1) which equals to 1.
- I kept looping from Step 5 at this point until the current value became 0.
- When the value became 0, other empty surrounding cells will be filled with random values from 1 up to the value of the central goall cell minus 1.
- Then the game starts.
On top of this process, I also took note of the maximum number of iterations we can do until we end the loop. This prevented events wherein we ran out of slots to fill and the current value is still not yet zero. The maximum iteration I had to employ was 3 iterations. That means if whatever the current value is by the third iteration, then it will be slotted into an available spot.
In the instance that I was not setting up the game and I had to keep the game going by generating new values, there were some extra steps into the process.
- I still started off with a random value from the central goal cell.
- Then from there, I ran a random chance of either generating a new value from a now empty selected cell or selecting a random value lower than the value of the central goal cell.
- In the case of generating a new value from a now empty selected cell, I generated a random value from 1 up to the value of the central goal cell minus 1.
- Similarly, the randomly generated value will be subtracted to the value of the central goal cell and will be noted as the current value.
- Then after having that value assigned, I went back to Step 2 while also keeping track of how many empty cells are still available. The number of empty cells now dictated the number of iterations that can be made to prevent a lock out situation where there is no solution.
- In the case of selecting a random value lower than the value of the central goal cell, then its value will be noted. Its value will be subtracted to the value of the central goal cell and will be noted as the current value.
- Then after that, it goes back to Step 2.
- Once current value is 0, then I just filled back in empty cells with a value from 1 up to the value of the central goal cell.
There are a lot of steps and it is harder to explain them in words but one thing is for sure, this really pushed my skills in making a procedural endless runner and, most importantly, my quick math skills.
Grid Challenge
Feature
Grid Challenge mode later came in as a proposal to add more challenge to the game. Its audience is really aimed for more experienced players almost going to the territory of puzzle game players. It is more complex with its features as follows:
- A user-defined grid that is filled procedurally with number values
- Target cells are defined by a value and must be reduced to zero by surrounding number cells
- Surrounding cells reduce the value of adjacent cells by its value
- If all target cells are are reduced to 0, then the player wins
- If one of the target cells are reduced to a negative value, then the player loses
I was the one who pitched in this kind of challenge in the game to introduce variety in the game. In retrospect, the design of the game was too punishing and could be improved by giving the players a chance to deselect a cell.
Implementation
But implementing this grid-based puzzle feature was the most challenging and interesting part of the project. I had to make it modular and procedural so that we can make a lot of interesting shapes in the levels instead of hand-placing these things.
For the modular part of this project, I made a simple text parser that reads every character and translates it into a grid. The following characters are being read to make up for the grid:
- x - no button should be here
- a - a surrounding cell will be spawned
- number value - the value of the target cell
This was how the screenshot above was made through parsing Xs, As and numbers in text file. Making levels are now made easier and faster because we just need to define a shape and it will automatically fill in the level for us.
Now for the procedural part of it, it's a lengthy and complicated process that involves a lot of looping and catching edge cases but the simple breakdown of how it generates the values in the grid is that instead of just maintaining the values of the surrounding cell, we add on top of it.
The process shares some similarities as to how surrounding cells in the timed challenge are made but with an extra step of adding on top of it as it moved out.
- I started with a random target cell value and fill in the values moving out.
- From there, I put random values on its surrounding cell that is less than its value.
- To accommodate for multiple solutions, when moving further out, if I generated a random value from a cell.
- The value from step 3 will have a chance to add its value to the surrounding cells. So if a cell generates a 2 around a 3, 4 and 2, those three values will become 5, 6 and 4. Possibly it can even be 5, 4 and 4 to also account for wrong solutions.
Using this method made the surrounding cells of the target cell much larger in value and forced players to really work from the outside then go in. This method also accommodated for multiple solutions and made sure that there was no locking out of the level. It made sure that players have a way to figure out a solution.
Overall, making this feature pushed my logical skills to the test as to how the algorithm will work with me in making levels. I did not put only my programmer hat, but I also need to put on my designer hat as the rules should make sense and solutions should always be viable. With that said, this feature taught me how procedural levels work with a lot intentionality put into it.