New demo video for Starship app

Your chance to save the galaxy.


For more information on this Android app: see Starship Alpha Test and articles tagged “space war”.

Posted in Android | Tagged , , , | Leave a comment

Improved Play Screen in Starship App

The latest alpha test version is out for my Starship game app on Android. The big improvement  is the new action bar along the top of the screen. Status bars show the energy level of the ship and shield strength. Time left, enemy count, damages, and speed are also shown. The new status indicators provide better feedback as you play.


This version also includes Google Play leaderboards.

To try the Alpha test version of the app, go to the Google+ community for Starship and click the “Join” link:

Try the Starship app

Further design improvements are on the way. The Beta test version should be available August – September 2014.

Posted in Android | Tagged , , | Leave a comment

In-app Billing in an Android Space War Game

I am going to write a series of articles about how to implement in-app billing for an Android game app. I will get that started by telling you something about the game app I am working on and how in-app purchases tie in to upgrades within the game.

Coin purchase screenshot

The name of the app is “Starship”, but that’s likely to change during beta test. Starship is a turn-based, single player, space war game. It is available for Android phones and tablets. The game begins with you in training. You take on training missions that allow you to advance through the ranks of Weapons Officer, Navigator, Commander, and finally, Captain. Upon promotion to Captain, you command a very powerful starship. Your mission is to find and destroy alien starships that have invaded the galaxy. To end the threat completely, you must find the alien home world and destroy it. A screenshot from the game is shown below.


As you play the game and destroy alien ships, you earn gold coins. The coins can be used to purchase items that improve your capabilities. In the current version of the game, there are four upgrades that you can purchase:

  • Long Range Move Equipment – allows you to jump to a distant quadrant in one move. Crystals power this equipment.
  • Mining Equipment – allows you to mine crystals from planets.
  • Extra Starbases – give you more places where you can resupply and make repairs
  • Extra Mission Time – gives you more time to complete missions

None of these upgrades are made with in-app purchases. All it takes to upgrade is gold. There are, however, two ways to get gold coins: (1) you can earn gold coins within the game by going on missions, destroying the enemy ships, and moving up levels; or (2) you can go to the Coins store screen and purchase coins there.

The figures below show what a complete transaction looks like within the game. You start on the Coins screen, select an item to purchase, enter your password, and then wait for the order to be fulfilled. The white popup boxes are being done by code in the Google Play services library.





Once the receipt makes it back into the game, notice that the coin total in the upper right of the game screen increases by the amount of coins you purchased.


After the purchase, the player uses the Upgrades screen to purchase one of the upgrades.


Model for In-App Purchases

In some game apps, you have to make an in-app purchase if you want the extra equipment or powers. That is not the case in this game.

In Starship, you are not required to make in-app purchases to get ahead in the game. If you earn the coins playing the game, use them to make upgrades. If you would like to get those items a little faster, you spend real money to get in-game money. Of course, the other reason to make a purchase is because you enjoy the game and would like to send a little money to the developers as a way of thanking them.

Next Articles

This note is not a how-to article. What I usually do on this blog is provide working demo programs with source code. That’s what you will see in the next set of articles about in-app billing and purchases.

Topics for the upcoming articles include:

  • Suggestions on how to get started with the TrivialDrive demo program.
  • Adapting the TriviaDrive demo to your own application.
  • Tips and suggestions for testing in-app billing.
  • Tutorials and suggestions for building your own Coins and Upgrades screen.
    (Some of this is already available. See below.)
  • Different ways to invite players to upgrade.


New Turn-Based Space War App - article about the Starship game app. Read this if you want more information about the game or would like to be part of the test community.

Update on Starship game - a short note about some new features in the game.

Android Fragment for an Item in a Store – article about a demo app that uses Android fragments to displays items in a list. The same fragment is used in the Starship app for the Coins screen and the Upgrades screen.

Examples of Store Item Activities in Android – a follow-up article to the fragment article.

Google I/O 2012 – Monetizing Android Apps - a talk from Google I/O 2012. It covers the different ways you should consider for making money from your apps.



Posted in Android, Game Design | Tagged , , , , | Leave a comment

My Reminder: How to fix “conversion to Dalvik format failed with error code 1″

Every month or so, while exporting an Android application to get an apk file, I see the mysterious message: “Conversion to Dalvik format failed with error code 1″. Information on what to do is easy to come by. I search Google on that phrase and get to another great StackOverflow page with an explanation.

export-app-error-code-1The problem for me is that particular question /answer post is fairly long and points out that there  are several different things you should try. Since I keep forgetting which of those work for me, I am posting ny standard steps for myself here.

I work on a Macbook, run Eclipse, and I usually do very well at keeping my Android environment up-to-date. Also, when I build I have Proguard set to run, which means I will see some unusual messages from time to time. Those tend to throw me off and forget what I should be doing.

My Standard Fixes

  1. I start with doing a clean build of the project with “Project – Clean”. I include the project and any projects it depends on.
  2. Then I check to see which Proguard I have installed. A new Proguard is required. Right now that is 4.11.

Step 1 used to be all I needed to do. I’d do the “clean” build and then try to export again, and it would work. This last week, however, that did not help. The export would fail and the Console messages would indicate that Proguard was having trouble. There are, of course, lots of things that Proguard can report on, but these messages said that none of the classes of the app itself  could be found. That did not make sense to me since I had built apk files for the very same app not long before. So that’s when the closer reading of the StackOverflow message paid off.  Someone noted that a newer Proguard fixed the problem for them.

Android tool set for Eclipse has an old version of Proguard. One more thing to watch out for is that the Android tools in Eclipse have an old version of Proguard. Any time you update that part of your Eclipse installation, it is going to overwrite the new Proguard you installed with one that might not work. So that’s why I have two steps. Fixing the problem with Step 2 is something I have to keep doing until the newer Proguard is in the Android tools update. The Proguard folder is inside folder “android\sdk\tools”.

So good advice, as always, from StackOverflow provides a solution. And for me, a good reminder is what I need so here it is in an easy place for me to find it.


Posted in Android | Tagged , , , | Leave a comment

How to View an Android Shared Preferences File

Here is what I do when I want to see the contents of an Android Shared Preferences file when I am debugging an app.

1. Change the AndroidManifest.xml so the app is debuggable. Add a line in the <application> tag.


2. In Eclipse, run the application in the debugger. That is the “Run – Debug as …” menu item.

3. Run the app until you get to the point where you want to see the contents of a shared preferences file

4. Then start a terminal session and do the following commands after using the Android Debug Bridge (ADB) to start a shell.

adb shell
 $ run-as com.wglxy.starship
 $ ls

 $ cd shared_prefs
 $ ls
 $ cat game_data.xml

For your own app, be sure to replace the text in italics with your app’s package name and the name of the shared preferences file you want.

The two ls commands are there to reassure yourself that you are in the right place. The last command (cat) copies the contents of the shared preferences file to the Terminal window. After that, I usually copy all of the text from the Terminal windows to an editor or text viewer so I can take a close look at it.

I do not know exactly where this works. I work in Eclipse Indigo on a Macbook.  These steps work fine with my Nexus 7 tablet, which is running Android 4.4.2. However, it does not work on my Galaxy Nexus phone (Android 4.3).

Sorry for the imperfect solution, but I thought it would be better to share a partial solution because, when it does work, it is quick way to see what is going into your shared preferences files.


Thanks go to Dennis Kubes for writing “Read Android Data Folder Without Rooting“. It took me a while to figure out which devices I could use his suggestions for, but now I use it all the time.

Posted in Android | Tagged , , | 2 Comments

More Mobile Enemy in Starship App

For those of you who are following the progress of my Starship game app for Android, here is a short update. The latest alpha test version of the Android app is out. Version 0.93 features a more mobile enemy fleet. At level 1, the enemy move when a Commander ship is nearby. After level 1, all enemy ships move. Leaderboards are working again. Sign in to Google+ to use them. Touch Leaders on the Menu screen after you get through training.

To try the prerelease version of the app, go to the Google+ community and click the “Join” link:

Try the Starship app

Please note that improved graphics are on the way. Look for better graphics in the Beta test version, which should be available May – June 2014.

The latest demo video is on Youtube.

Related Articles

For software developers interested in how this app was constructed, read these blog articles.

Posted in Android | Tagged , , , | 1 Comment

Lessons from Angry Birds: My Thoughts on Android Game Tutorials

I would like share a few thoughts about designing tutorials for an Android game app. The game, which is a space war game, is not extremely complex but there is enough there that a casual player might have trouble getting started. Commanding a starship is, after all, not a simple task.

In this article, I will tell you what I did about that problem. I will tell you about what I learned about game tutorials from Angry Birds and how I built that into my own app. Figures 1 shows the end result in the Starship game. Figure 2 is an Angry Birds tutorial. To see the animations, there is a YouTube video later in this article.

Figure 1: Tutorial for How To Dock a Starship

Figure 2: How to Use the Slingshot in Angry Birds

There is a little bit more to the story than Angry Birds. I also have been studying gamification and found several good presentations with advice from game designers about what helps you make good design decisions related to onboarding new players. I will discuss that too.


Several months ago, I decided that I needed something to introduce players to the game that was more engaging and easier to grasp than written instructions on a screen. I looked around, but I didn’t find any advice that was particularly compelling about how to do this for an app. Looking on my phone, I asked myself: “What do other games do to get people engaged in the game and get them started?” Two old favorites do a great job with some simple animations: Fruit Ninja and Angry Birds.

Take a closer look at Angry Birds. When you first install and start, the game does two things for you early on. First, they tell you the story of what your task is, in only two screens — pictures, no words. The nest is empty; the eggs are missing; the pigs have the eggs; you must get them back.


Then comes the one and only bit of instruction. You see a simple animation that shows you how to touch the screen and pull back on the slingshot. That animation repeats until you, the player, get it and hit the next button (a checkmark). At that point, you are ready and the games start.


Angry Bird became my model, at least as far as tutorials are concerned. A tutorial view pops up on top of the game and runs an animation. In the animation, a finger moves, screen touches are shown, and the resulting action is illustrated. The animation repeats until the player touches the Next button, ideally indicating that the instructions are understood. Two screenshots from my Starship game are shown below.


Unlike Angry Birds, there is a lot to learn in the Starship game. To command a starship, you have know these things: how to move, how to fire weapons, how to repair, how to scan for aliens, how to locate starbases, etc. Originally, I had thought that a few pages of help would be good enough. You’d read a few pages to learn what commands were available to you as a starship captain and off you’d go. Well, it didn’t take long to realize that there are way too many commands to qualify as “a few pages of help”. Besides, most people don’t want to read. They just want to shoot some aliens.

I adopted the Angry Birds style of tutorials and found ways to make use of them in the overall onboarding experience for new players. Level 1 of the game is where new players see them. (More on that in the next section.) In total, there are over ten different tutorial animations in the Starship app. You’ve seen a few screenshots above. If you want to see them in action, you can see several of them in the following short demo video.



I have done a lot of research on game design and gamification lately. Some links are provided in the References section below. One of the most useful references was a presentation by Amy Jo Kim titled “Smart Gamification: Seven Core Concepts“. The topic is gamification, but what Amy Jo Kim does is share tips and advice that are based on her experience as a game designer.

The most important lesson for me was the concept of a player lifecycle. There are three stages: novices, regular, and enthusiasts expert. Amy Jo Kim suggests that you design the player journey from novice to expert.


For that point in the presentation, go here: The whole presentation is great. Be sure to listen to it.

Amy Jo Kim also says: “Newbies need to learn the ropes … think about the first 1-2 months of the player’s experience”. She urges you to figure out the “arc of learning” that you will guide newbies along.

I took that to heart and made the entire first level of the Starship game be the training level for newbies. I incorporated that into the flow of the game. The game begins with you in training. You take on training missions which allow you to advance through the ranks of Weapons Officer, Navigator, Commander, and finally, Captain.  Upon promotion to Captain, you are given command of a very powerful starship. Your mission as Captain is to find and destroy alien starships that have invaded the galaxy.

Even as Captain, your first few missions are in region of the galaxy that is smaller in size and that has few alien ships to destroy. That, I hope, further smooths the transition from newbie to regular.


I have told you a little about what I did and why. Two main things were tried:

  • Angry Birds tutorial style
    Difference – many tutorials, not just one.
  • Amy Jo Kim’s suggestions for player lifecycle

I tried to make onboarding interesting by having the player advance through the ranks. I tried to create a sense of achievement and reinforce that with badges for individuals and ranks.

The following questions are unanswered, and I was hoping that some of you Android developers and other blog readers could help me out.

  1. Does an Angry Birds style tutorial work? Do you really know what to touch to make something happen?
  2. Is it effective to earn ranks while you learn the game?
  3. Or does it make it look like the game is not interesting?
    In other words, does it take too long to get to a game that’s fairly challenging?

You will have a better sense of the game experience if you try the app. It’s available in the Google Play store as an Alpha test app. To get the app, just visit the Starship app community on Google+. Click the image below or the link below it. Once you get to the community page, click the “Ask to Join” link on that page to request an invitation. Download instructions are on the community page.

Try the Starship App

If you have any general thoughts on game tutorials or comments about the tutorials in Starship, I’d appreciate hearing from you in the Comments section below or within the Alpha test community.


In a future article on this blog, I will explain how I built the tutorials. I started with the animation examples in Android API Demo sample app and saw how they had a set of objects define drawing operations on a Canvas. I built on that idea so I could have several animations working in combination for a tutorial.


I have been studying game design, gamification, and other topics over the last 18-24 months. Many of the ideas for tutorials and onboarding that I am trying in the Starship app were inspired by the following presentations.

Gabe Zichermann
Fun is Future: Mastering Gamification
Some of his points:
- Onboarding tutorials should be built into the first level of the game.
- “The early days of any game are super important …”
- “What we used to call the tutorial level, but now we just call it level 1″:
“in the olden days …”  and “… reveal the complexity of the game in slow steps”.

Amy Jo Kim
Smart Gamification: Seven Core Concepts for Creating Compelling Experiences.
For the key points, see the “Lessons From Game Design” section above.

In general, anything you find from Amy Jo Kim is worth looking at. Here are two more that I recommend: Lifecycle Design for Social GamesSmart Gamification: Designing the Player Journey.

Posted in Android, Game Design | Tagged , , , , | 1 Comment