Showing posts with label pigmentandthedroid. Show all posts
Showing posts with label pigmentandthedroid. Show all posts

Wednesday, 7 August 2013

Pigment & The Droid, Part 3

As foreshadowed at the end of Part 2, the optimisations described therein were not enough to get Pigment to run on the Motorola Droid. Pigment was still using too much memory for the Droid to handle.

So: to get Pigment to run on a Droid it needed to use less heap.  How to accomplish this?  It needed to hold less graphical data.  I'd already reduced image memory size as much as possible regarding format and storage options (such as removing the alpha channel);  I either had to load less of the assets, or generate less content as the game ran.  In the end I did both!

The first saving relies on how the user experiences the game; as they play and complete levels the game will send messages to them: the Win! message, the tip about pressing Back to undo, the Bonus Unlocked messages, the Congratulations on completing worlds / the game.  Of these: the Science  Unlocked message and the final Congratulations message on completing the game made a useful pair.

Wednesday, 7 November 2012

Pigment & the Droid, Part 2

As outlined in Part 1, the HTC Desire bracketed the heap allocation of Pigment.  That is, while developing the game, if it failed to work due to lack of memory then it would be cut back in order to fit, and thus the game came to be defined, at least in terms of heap allocation, by the Desire.  However, there came a point in development where more assets were required than could fit - there seemed to be no more screens to cut, no bitmaps that could be not-loaded, but something had to give in order for the game to work.


In order to fit more assets into memory than could physically go, Pigment uses a trick based on how some of the assets relate to each other.  One group of bitmaps the game uses are the messages, the info screens sent to the user after certain events; the "Win!" message, the tip about pressing Back to undo, the Bonus Unlocked messages, the congratulations message for completing worlds / the game.  Of these, the Science Unlocked message and the final congratulations message on completing the game made a useful pair.

The Science Unlocked message always (and only) displays after you complete your 4th level.  It doesn't matter what level it is, but when you have completed four levels total the Science Unlocked message is displayed (and, of course, the Science skin is unlocked in the Bonus menu).

The End Game message, on the other hand, only displays once you have completed every single level in the game.  Clearly it is very unlikely that a user will see both these messages in one play session.

Monday, 5 November 2012

Pigment & the Droid, Part 1

When Pigment became available as a free download on Amazon's FAotD feature it became clear very quickly that there was a problem: it didn't work on some Motorola handsets - the Droid 4, Droid Razr and Razr Maxx were all reported specifically by unimpressed customers.  So: why did it crash on those phones, and how could it be fixed?


While the Amazon App Store beats Google Play hands-down at promoting your app, it is lacking in Play's technical features. Notably, if your app crashes on a Play user's phone, then they have the option to send you a report which tells you pretty specifically what went wrong.  Amazon do not (yet) have this facility.  As such, there was no way to know what was going wrong with Pigment, aside from guessing.

Educated guessing.  For one thing, customers were reporting it was crashing on the splash screen: the splash screen is displayed while the game loads its assets into memory.  For another, these type of crashes happened often during development: they occurred when the device ran out of memory.

"Out of memory?", you say, "But my phone has 16GB of internal storage!"  The memory we're talking about is the phone's temporary storage, not the place it permanently saves things.  That 16GB is the phone's equivalent of hard disk space - what we're running out of is RAM.
"But my Razr has 1GB of RAM!  How can you be using all of that up?"  Ah, a good question, the answer to which is found in how Android works: