Pancakes was updated to 2.0.4 to fix an embarrassing bug. The bug caused the game to crash when the very last level was completed. It’s the kind of bug a rookie programmer makes. What was the bug?
Embarrassing is an understatement. I’ll probably never hear the end of this from my twitter friends – @EdMakesGames if you want to follow me – because this is one of those errors that nearly all programmers make once or twice and then NEVER AGAIN. For the record, this is the first time a bug like this has made it into my production code.
Pancakes!!! has 400 save game slots, one for each level. The slot records information like the number of stars the player earned, the players score, and whether the level is unlocked or not. The save game slots are stored in a basic array that looks like “Game1, Game2, Game3, Game4, …, Game400″ all lined up in a neat row in the computers memory.
It’s All About Access
The computer accesses the data in a special way. The first slot is actually slot 0 and the last slot is slot 399. So if I want the data for Game2 I ask the computer to access slot 1. If I want the data for Game400 I ask the computer to access slot 399. So what’s problem?
In Pancakes!!! when the player completes level 400 I tell the computer to save the data for Game400 in slot 399 and then – this is were things go bad – I tell the computer to access Game401 in slot 400 and unlock the level. KABOOOM!!! CRASH!!! FORCE CLOSE!!!
Why Did It Crash?
Because there is no Game401 and there is no slot 400 so the computer doesn’t know what to do and just crashes. Actually, it throws an exception first – that I don’t catch – and then it crashes.
What’s the fix?
The fix is simple, I increased the size of the game slots array from 400 to 401. Problem solved.
But What If Someone Tries To Play 401?
There is logic in the game that prevents Game401 from being played. Instead, it shows the end-game cut scene that one person has described as “Quite Epic”.
The patched version is up on Google Play. So go get it and let us know what you think about the end-game cut scene.
Thanks for supporting indie developers, like Flowerpot Games!
Pancakes!!! is a super sticky and oh-so-sweet game for Android. Download and try it for free on Google Play: https://play.google.com/store/apps/details?id=com.FlowerpotGames.Pancakes.Demo
Mobile Montessori is an educational and fun app for children. Reinforce color recognition, shape recognition, number matching, and number quantity association in the children you love. https://market.android.com/details?id=com.FlowerpotGames.MobileMontessori.Free