Happy New Year 2014!

Happy New Year 2014 everyone!

Don’t make new year’s resolutions you cannot hold 🙂 Just live to the fullest, respect and love everyone equally! Make small things count!

My resolutions are (in no order):

  1. I am gonna learn some French.
  2. I try to enjoy whatever I do.
  3. I will try to take some time to learn new things.

Brief game update: I have improved my core loop which should make the game even more responsive and it should save some resources. I added Google Analytics so I should know what is happening within the game. I need to learn how to utilize it though 🙂

Advertisements

In App Billing

In the last post I wrote about how I have been adding In App Billing to my game. During the Christmas I had enough time to finish and test the implementation. Thanks to my IAP testers as well!

Adding the In App Billing can done in few simple steps. You need to do the following (at least):

  1. You need to have Google Wallet merchant account
  2. Download Google play billing library with SDK Manager
  3. Add the application to the Developer Console
  4. Implement the workflow
  5. Test the application

A complete tutorial can be found here.

Unfortunately the example code provided by Google isn’t very good. It contains some bugs, some serious ones too, so you really need to know your workflow well and understand the example. The util classes you are going to import (if following the Google tutorial) as part of your app contain class named IabHelper. This class has a variable boolean mAsyncInProgress which is a flag to allow one Async call per time by the helper. This flag is modified by methods flagStartAsync and flagEndAsync which are package-private scope.

Well the class doesn’t do very good job since sometimes you get IllegalStateException when using the IabHelper. (Extra note: I personally don’t like this type of naming of the variables with scope because it prevents the use of code generation with modern IDEs like Eclipse).

You probably can find related articles and posts in different forums, like SO (StackOverflow) and some of them guide you to change the flagStartAsync and/or flagEndAsync to public and verify manually each time by calling that method so it will not throw an exception. Some say wrap your code with try catch blocks to prevent it.

Well, I think the code author wanted the flag to be handled internally and that’s the reason for package-private visibility. Surrounding the code with try catch is bad idea too because you are really not handling the real cause, rather just the symptom.

My solution was to tweak the code so that I appropriately call flagEndAsync in correct places of the code (IabHelper). You need to check this with your own flow but this is problem many other have found as well. One issue regarding the IabHelper is the fact that it throws NullPointerException if used in Emulator. In startSetup method:

replace:

if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {

with :

List queryIntentServices = mContext.getPackageManager().queryIntentServices(serviceIntent, 0);
if (queryIntentServices != null && !queryIntentServices.isEmpty()) {

This is probably because the Emulator packageManager cannot find the InAppBillingService intent and the returned list is null. This works without the check in real device if you have followed the tutorial and implemented it correctly.

Testing the purchase flow is whole another story. I will not get down to that now.

This is how my game currently looks. There’s few less buttons than before and few new ones. “Get hints” -button initiates the Google In App Billing flow and “Use Hint” -button uses a Hint if you have them left. For UI consistency I changed the “Exit” -button to similar “Quit” -button as in Main Screen and I removed “Next” -button which takes you to next level then you have completed the level. Now you just tap the screen to do so.

What do you think?

Image

Merry Christmas Everybody!

It’s been really busy lately but I just wanted to take this opportunity to wish everyone Merry Christmas!

Regarding my word game project, there’s a little bit of news. I am adding Google IAP feature into my game. I already added hints so now it’s easier to get by those very difficult words. My plan is to make hints IAP so you will get initially certain amount of hints (not decided yet how many) and when you run out you need to purchase more. Let’s see when I have time to actually implement this. 🙂

Beta testing results and more

Okay, last weekend I got my game to a stage I could call it a BETA. I asked some (well, generally all who were interested) of my friends to test the game and provide me some feedback. I posted this to FB, Twitter and LinkedIn. Luckily I got  a decent bunch of friends who wanted to help me. Thank you for everyone!

One of the major issues what I was not aware of was the screen scaling in smaller resolution devices. I thought I got it handled but I didn’t. With smaller screens some of the elements were drawn nicely but some were on top of each other and so on. And my custom font was drawn unintentionally large (without no scaling). It was my own mistake not to test with smaller resolutions and partially because testing with Emulator is painfully slow.

It took me a while to fix all the places with the scaling and with newer version even smaller screens started to working better. I still have some issues with AdMob sizes. I know there’s a table of the sizes but I cannot allocate so big portions of the screen for ads. I have to think of another way.

One issue was orientation related. I had fixed the orientation to landscape and I thought I did it the right way. It seems that with some tablets you can use the “case” or cover to create a stand and have the device supported by the stand so that the orientation is actually landscape reverse and since mine was fixed to normal landscape the game was upside down. This was easy to solve by changing the orientation to android:screenOrientation=”sensorLandscape”.

The game didn’t crash for most of the testers and there’s just one unknown bug related to gestures that causes crash on one particular device / user (that was HTC one). I wonder if this is related to android version or what. I was of course happy in general because game seems to be very stable.

One thing testers wanted the most was some kind of help or hint / tip. I originally didn’t have that type of functionality in mind but I started to think that maybe it could be a good thing. I yet have to figure out how to implement it and come up with things like how the amount of hints are granted / created or where to get them, but currently the amount is just static number.

This is currently under development. Some of the words, specially for non native, can be pretty difficult.

Screenshot_2013-12-08-23-39-56

What is cloque anyway 😉 ? Even WordPress auto correction doesn’t recognize the word! Duh, according to Wiktionary:

cloque

  1. A fabric with an embossed design.

Oh well. Maybe it’s just me then… 🙂 🙂

p.s. If you have been following this you notice one extra button as well. I put a clear -button in place to clear the current guessed word. It became useful as well.

Time for a retrospective

My game is now officially in BETA phase. The game is called WordSlinger and I have sent it to a bunch of friends who are so kind to help me testing the game.

It seems that there’s no good way of building a network of BETA testers or doing BETA. If you publish the game in Google Play then anyone can download it and play. I have understood that it’s possible to create a Google+ Group to which you can invite people and have them to test your application. I don’t have Google+ account and I didn’t feel I want to create it just for this. I solved the problem by creating a release build, signing it with my key and sending it via email to bunch of friends. I wonder how everyone else is doing this?

So, it took approximately a full month of time creating the game. I have done everything from scratch and by myself. I used FreeSFX library to find nice sound and that’s what they are credited for. Thank you FreeSFX. The month I refer here is full working time. In calendar time it’s a lot more but since I have a day job and other hobbies I was mostly working in the evenings and weekends.

I haven’t had any other costs if you don’t count the time. I am not sure if there was a developer fee for Google Play account but if there was it was quite small. If I would want to calculate the time spent as a cost then the cost is one man month. In Finland (where I live) the cost for average developer would probably vary between 3000 – 5000 euros / month. Having said that, you could get a similar game developed cheaper too. Specially because I spent a lot of time to learn things and building the engine, rather the game.

It goes without saying that if I would be doing this for money then I probably would never get even and definitely it would be much harder road to do this as for a living with these type of figures. But since my goal was to learn and have fun, not to make money, I am very happy. I am happy and I have learned a lot. I would like to turn things around and ask: Are these things (that I have learned) worth the time and possible cost of 3000 – 5000 euros ? I think they are…

I have learned:

  1. How to create an Android Activity
  2. How to run and debug it
  3. How to deploy it to emulator and real device
  4. How to utilize local database
  5. How to handle application life cycle
  6. How to draw on Canvas and to use Bitmap
  7. How to create Sounds
  8. How to read user input and gestures
  9. How AsyncTask and Threading works
  10. How Google AdMob adds can be used
  11. How Scoreloop social platform can be integrated
  12. How to draw simple buttons and logos with Gimp
  13. How to create a custom font and use it
  14. How to create a release build and sign it
  15. How to use Proguard and how to configure it
  16. How to calculate screen coordinates for different resolutions

And the list goes on. I have probably missed a lot of good points but this gives perspective. One of my goals was to learn something that I can utilize in my everyday work. If I would be doing something with Android all the stuff above WILL help me immensely. That is nice as well.

Anyways. Here are some screenshots from my game in BETA phase:

Screenshot_2013-11-10-23-13-41

Screenshot_2013-12-01-19-51-14

Screenshot_2013-12-01-19-51-51