Sunday, August 7, 2011

Developing Android apps: it's really not so bad!


There's been some talk recently about how Android development can be difficult for newcomers to jump into (for one, this rant on Hacker News, claiming that you'll need "months researching Android design patterns"; the top rated response is mine.) I thought I'd elaborate and show my roughly two week journey from deciding "hey, I'd like to try building an app some time" to releasing a full blown, (IMHO) polished Android app to the market. I plan on following up with more stats in a week's time to show how I'm doing with revenues, downloads, etc.


Background

I'm no stranger to programming. I taught myself how to program in QBasic in 1995 (when I was 7) on a little computer running Windows 3.1 (although I worked solely from DOS.) I made dozens of little QBasic games. Had I been born 10-15 years earlier I could've had a great career making crappy looking, low-res games.

One game that I started and never finished back in the QBasic days was my version of Archon II: Adept. Disclaimer: I never actually played Archon II, I just saw it in an old magazine once and thought the idea of summoning creatures onto a chess-like board and having them duke it out seemed pretty cool. I'm not sure if that's really what Archon II is like, but I had no money and an active imagination.

I got my first Android device, an enTourage Pocket eDGe, on July 7th, exactly 1 month ago. (I can't recommend the device enough, but unfortunately enTourage has gone out of business.) After a few weeks, I decided to try my hand at developing my own Android app. For my first Android project, I thought it would be fun to take another shot at finishing the "Archon II" concept so I could play it on my Edge.

I'd never programmed in Java before, although I have similar experiences: I worked with C# which is almost identical to Java, and I also worked for a couple months in ColdFusion, which is an abstraction on top of Java.

Something that I really believe helped me get started smoothly was, frankly, my attitude. I don't waste time hating on Java, even though it's the cool thing to do. Java is what it is, it's very much ubiquitous right now, and it's just not productive to complain about it. Every language has shortcomings; Java is the standard language for Android development, so it's what I used. Also, when I first got started I hadn't yet read the plethora of blog posts about how terrible Android development is and how little money its developers make. I enjoyed the development process and, while it remains to be seen how my app will perform, I'm optimistic.


Getting Started

A simple Google search yielded some great tutorials that showed me how to get started with the Android SDK on Ubuntu. The whole process, downloading the SDK and Eclipse plugin and getting everything set up, took roughly 10 minutes, after which I grabbed a Hello World tutorial and was beyond excited when I got a custom text message to appear on my eDGe. It had begun.

I quickly became familiar with the Android development ecosystem: drawables, XML layouts, etc. I loved the fact that I drop an image into my drawable folder and refer to it by name or store it as an integer field in a class; with an XML drawable I could specify which image to use for a button by default and which to use when it was pressed. XML layouts were also a great alternative to programmatic layouts. Settings could easily be stored in preference files and retrieved by name, eliminating the need to create my own settings file read/write system. (At this point I really can't give enough props to Reddit user Lorc for his extremely high quality set of game images that have been made freely available. With a little coloring they look magnificent on a mobile device.)

Another great thing about Android development: for just about anything you might need to do (everything I needed to do, anyway), there's a helpful tutorial by someone who's done it before, and it's only a quick Google search away.

One hurdle I ran into: testing my app on the Android emulator. While convenient to test different display sizes, the emulator is painfully slow and took upwards of 10 minutes to boot up the first time. Not helping was the fact that I do most of my development on a netbook that's not especially powerful. I got around this problem by using my actual device for testing, using USB debugging mode when necessary. Problem solved.


Polish

I was busy full time during the day, but working only nights I was able to put together a working, playable prototype of my game within 4 evenings. (Confession: I stayed up pretty late some of those nights.) That was the easy part - I spent about a week and a half making various improvements and preparing for release.

The main difficulty at this point was the fact that I'd developed solely with the eDGe in mind, and there is a huge array of potential Android devices, each with their own resolution and capabilities. I came up with several ways to address this problem: using different layouts for different size devices, programmatically shrinking/expanding the size of the board and side bars, and including different sized boards for screens with different aspect ratios in the Settings menu.

I had some family members test the game and made some improvements based on feedback I got and new ideas I had. I made the UI more responsive by making the board extend SurfaceView instead of View, resulting in smoother animations. I simplified the controls, added trophies, and implemented a simple tutorial system that would give helpful messages the first time the user did certain things. I tried to keep things simple and intuitive to appeal to mainstream Android users.

I implemented an enemy AI that's pretty basic but still manages to beat me regularly. It looks at its potential moves, evaluates the condition of the board after making each move, and decides which is best based on things like proximity to allies/enemies and relative strengths and weaknesses.


Marketing and Release

A few days ago I committed on a Sunday evening release date, as I could keep polishing the app for years without releasing if I didn't make a firm decision. I reasoned that weekend evenings would probably see lots of users checking the market. I decided to release under the pseudonym "MonsterFace Games." "Monster face" refers to the face our cat makes when she's scolded, a kind of half-scowl that just barely shows teeth.

On Friday I started letting friends know that it was coming, posting to Facebook and Twitter. Saturday I learned how to integrate Google Analytics and AdMob into the game to serve ads on the free version and track statistics like what creatures and elements were most popular, what trophies were earned, and how often players won or lost.

One more unexpected speed bump - my release was about 3 hours later than I had hoped because I ran into problems putting up a free and paid version of the same app on the Android market - something that could've been a little more clear. But it's official, two weeks from concept to release of a full Android game with minimal dififculties. Stay tuned for updates on how Summoner performs during its first week.

Links

Summoner Lite - web, mobile
Summoner - web, mobile
Follow MonsterFace Games on Twitter: @monsterfacegame

17 comments:

  1. << "Monster face" refers to the face our cat makes when she's scolded, a kind of half-scowl that just barely shows teeth. >>

    This sounds hilarious. Please post a picture of your cat making this face.

    ReplyDelete
  2. Couldn't agree more. In a month of *very* part-time effort, I wrote a simple Android app. A month later, Lifehacker had covered it. A year later, I've grown a lot, the app has grown a lot, and we've had 50,000 downloads. Android is not hard to begin development for; you need to JFDI.

    ReplyDelete
  3. Well done man. I love it when a dev just drops the FUD and gets stuff done. Definitely inspiring.

    ReplyDelete
  4. Great inspiring post. Your secret weapon is that you are extremely focused and obviously smart. Keep posting on your progress.

    BTW, your site, probably the big background, makes it almost impossible to use it on a tablet, everything is very very slow. It took me like fifteen minutes to type this up. I am starting to hate WebViews right now.

    ReplyDelete
  5. Thanks a lot for this. I've been working on an Android app for a while now, and I've been getting overwhelmed with small problems. This has inspired me to settled down, focus, and just do it.

    ReplyDelete
  6. What was the problem you ran into releasing the free and paid version in the market?

    ReplyDelete
  7. @Anonymous - next time she does it I'll try to get a picture.

    @Artem - thanks for letting me know, I'll try to do something about that.

    @Tom - the problem was that I didn't understand how apps on the market work very well. I had one application with a boolean value called "FULL_VERSION" that turned on/off paid content. I found out that separate apps on the Market need to have different package names which required a bit of redesigning. I also wasn't too happy to find that once you set an app to free, you can never charge for it.

    ReplyDelete
  8. A few questions. How did you manage the multiple screen resolutions? Did you write your software to work on versions earlier than 2.1? And did you consider using PhoneGap and perhaps HTML5 drawing and animation? Last, did you make a decent buck on your game?

    ReplyDelete
  9. @Anonymous - The main way I deal with different resolutions is to use LinearLayouts with weighted elements, then check in the code how big the various elements are in pixels and scale or alter their contents appropriately. The size of the board will scale to fit the available space, the side bar font/contents will change, etc.

    ReplyDelete
  10. 1. Archon 2 was a great game. I played it back in the day on my Atari 800. It had a chess-like strategy part and an arcade-like fighting part. Lots of fun.

    2. By my math, if you were born 10 years earlier, you'd still be younger than me, and you still would have had a tough time making a living making "crappy-looking low res games". :-) I started in the game business right around the time of Playstation 1 and 3dfx - pretty much the tail end of the low-res game era.

    3. Congrats on your perseverance. It's easy to get distracted, move on to something else, etc. Polish and completion is hard.

    ReplyDelete
  11. Can you pl describe the set up in detail and tutotials you went thru?

    ReplyDelete
  12. This is very inspiring, it kind of described how I got started developing in SecondLife (LSL is a java-like language).

    Having no real background in programming (aside from making some adventures on ZX-81 and MSX), this does sound like I could get started on developing something for my own Android based eBook reader.

    Thank you for blogging your experience!

    ReplyDelete
  13. Thanks for this post, I found it very inspiring as well. I have a very small amount of programming experience, so I was a bit worried about jumping in. I was going to do it anyways, but this game me a bit more confidence and a few tips.

    ReplyDelete
  14. Hi there.
    I enjoyed reading this info and will likely write up my own app shorthly.
    Thanx again
    pxl293

    ReplyDelete
  15. I don't think that new comers will find it difficult to tackle with Android game development if they are hard working and have enthusiasm to prove themselves like you. People who takes interest are definitely capable of doing something creative.

    ReplyDelete
  16. You learned Java and wrote a sophisticated android game about little creatures battling it out on a chessboard in 4 evenings? Sounds a little fudged. A little too rosy.

    It took me 4+ hours to install eclipse and all the silly plugins and SDKs, a few weeks to understand how to follow one guy's simple obscurely obtuse tutorial. Why can't google release their own IDE to oversimplify the whole operation. They'd only get a massive surge of new android developers.

    ReplyDelete
    Replies
    1. Well, that's how it happened, although to be fair I had a little Java experience, a lot of programming experience, and had used Eclipse quite a bit before I tried. The game at that point was functional but not polished and was missing several features that made their way into the final version. Installing the SDK didn't give me any problems, although I've heard from plenty of others who had trouble with it. It is certainly baffling that Google is still endorsing Eclipse for Android development instead of releasing their own product.

      Delete