11 August 2013
Comments: 0

Transmutation: Suspend and resume

Things were going along great when I realised that I’d completely neglected to deal with suspend and resume for the Transmutation rewrite.

To be honest, it wasn’t present in the original version either.

Nonetheless, it is an important feature because that it’s required for some markets, and because the game can’t be restarted from an arbitrary level.

I’ve had to rewrite the game part of Transmutation because scoring was previously being maintained by the counters on the board as the colour change animated. While saving the game state is fairly easy, because the scoring isn’t applied the instant that a player makes a move, it’s possible for a move to begin followed by the app being suspended or killed while the score is processing. To work around this, I’ve had to rip the in-game scoring (not the score and achievement framework), and re-implement it so that it runs the instant the user clicks, yet allows the delayed update animations to proceed as they have previously.

I’m glad I started with a simple project like this and I’ll be sure to incorporate suspend/resume from day one for the next project.

Meanwhile, more drastic changes.

A couple of weeks ago I recounted a tale of hours lost trying to get MoPub’s official Unity plugin (and others) to work. In addition to bugs in the Unity plugin, I found serious flaws in MoPub’s implementation of AdMob for Android, which rendered it useless for my purposes.

MoPub has yet to acknowledge my reports. Looking through the support forum, there’s a lot of serious problems being reported that remind me of the sorts of issues I was seeing back in the day with Google’s AdWhirl, a similar product that was plagued by persistent integration issues.

Google eventually pulled the plug.

The main issue I have with MoPub is that the AdMob plugin miscalculates the size of the ads to use, resulting in tiny ads on large screen devices, or even worse, ads that are correctly sized, but can’t be displayed because MoPub has created a view that’s too small to hold the ad.

Fundamentally, this is a flaw in the design of the AdMob API which originally targeted phone sized screens. Google have introduced an automatically resizing “smart banner” which resolves this, but MoPub are still calling on the old API, mishandling the information that they receive, and then breaking the ads.

Because of this, I’m going to dump MoPub. It was supposed to save me time, but it’s just adding tremendously to my workload. I’ve decided to go direct to AdMob for now, and rather than implement it myself, I’ve purchased the Prime31 AdMob combo.

Hopefully MoPub will eventually sort this out, but based on the lack of feedback I’ve had from them, I’m not going to be holding my breath.

Both these changes have now been implemented into Transmutation, but they’ve taken a whole day and I have to start testing from scratch again.