Thursday, 26 October 2017

Hungry Caterpillar - a snake game for touchscreen and TV


Little by little, TheInvaderOne is growing up. She is now three and a half years old 😮

Her little sister, TheInvaderOneX 👶, is eight months old, and is now very interested in the Sensory app. She's also interested in whatever her sister happens to be up to at the time, crawling at light speed, making valiant attempts at walking, and trying her damnedest to "eat all the things".

Big sister has smashed it on the numeracy front, and has left the Count 1 to 10 app for dust. We're in the big leagues now - she has 1 to 100 cracked, addition and subtraction of small numbers sorted, and is starting to get to grips with simple multiplication and division. Of course, we're not drilling numbers, letters, languages, etc 24/7. She loves absorbing knowledge - she's like a sponge, but we don't want her to burn out before she even hits school - being bored at school from day one due to them not teaching her anything new would likely be a disaster! No, there needs to be plenty of downtime... Sure there's loads of toys to play with, and imaginative play, and creative crafts, and baking, and stories, and a bit of tv (if you have kids around this age and want to combine cartoon time with learning, check out Go Jetters and Numberblocks, both big hits in our home at the moment), and seemingly endless unrelenting viewings of Frozen, but she's also seen what Daddy does to unwind - play and make games, and she wants in!

Ok, so making games may be a way off yet, but playing them was definitely on the cards. My other half bought me a Raspberry Pi 3 starter kit as a birthday surprise, it's now a dedicated emulation machine, with a lovingly curated list of games on there. It's pretty much a NES Mini, and a SNES Mini and a "Many Other Platforms Mini", all rolled into one. My eldest has particularly enjoyed playing Centipede and Barney's Hide & Seek. She loves the arcade action aspect of Centipede, but the move from touchscreen puzzle games to a joypad controlled action game was a pretty big step, and before she truly "got it", it was game over. Over and over again. The Barney game is actually a fantastic game for first getting to grips with the concept of pressing buttons or moving a joystick to control an onscreen character (since you can't really lose), but it seems the controller we were using (a truly excellent bluetooth one by Moga) was a bit overwhelming, and the game itself requires no real skill or engagement (drop the controller and it will complete itself on autoplay - once you realise that, what's the point in playing anymore?).

I got to thinking about what would make a good game for three year old, one who so far has only been exposed to touchscreen "jigsaw puzzles" and "smash bugs at a picnic" type games.

Here's what I came up with:
  • The control scheme should be simple and intuitive
  • Rules governing gameplay should be fairly straightforward and logical
  • Threat should be absent, or extremely mild
  • It should look and sound reasonably appealing
  • You shouldn't be able to lose too quickly i.e. before you get a handle on what you're actually meant to do
I realised that we already owned the perfect game controller for a small child. It's not really a game controller at all. It's an Amazon Fire TV Remote. I mean, just look at this thing:

It's a wonderfully simple controller, and that circle up top covers all the basic actions that should be required in a simple child friendly game: up, down, left, right, and a single fire/action/select button.

I started out with an Atari 2600 myself, nearly 30 years ago. All the games I had were controlled by one of these bad boys:
Let's all take a moment to bask in the glory of its simplicity... Up, down, left, right, and a fire/action/select button. Yes, using the Fire TV Remote looked like a winner. If it was good enough for Atari in the 80's, it's good enough for me today.

Ok, control scheme and physical controller sorted, on to the next item, a relatively simple game idea. A lot of the best simple game ideas have already been done, but I'm cool with rehashing a tried and tested mechanic, not everything has to be innovative or ground breaking ☺ Thinking about simple games, I realised very few are actually forgiving enough to meet my requirements. Pong and breakout are actually quite tough games, especially if you've never played them or handled a game controller before. Miss the ball a few times and it's game over. A game of breakout could easily be over within seconds, and before any blocks were broken. No good, frustration is not fun. What about Pac Man? Space Invaders? Centipede? Same deal. Those old simple games were actually quite challenging, I guess that's what made them so addictive, and why world records exist for acing them! Then it struck me: Snake!
  • Simple control scheme: up/down/left/right, press the relevant button to move in that direction
  • Simple rules: eat as many apples as possible and don't bite yourself - seems like reasonable advice for anyone to lead their life by
  • Minimal threat: bite yourself and you have to start again (no big deal, right?)
  • Aesthetically appealing: Ok, nokia snake wasn't the nicest looking or sounding game, back in those days we didn't have much to work with, the 3310 had a 84x48 monochrome 1.5 inch screen, midi sounds, and a processor and memory to match. Luckily we have HDTVs and even HD mobile devices these days, so we can do something about that... And thanks to awesome people like Kenney and Kevin MacLeod you don't have to be an accomplished artist or composer to pull it off!
  • Impossible to lose too quickly: This is where snake comes into it's own - all the other simple old games I considered were challenging, and you could lose them all immediately. The snake game is challenging, but with certain rules in place (no static obstacles, wrap around scenes, starting length of 4 segments or less) it is actually impossible to lose until you have at least managed a score of 1, and in most cases you're unlikely to lose before the "snake" reaches a length greater than the world height.
I put together a small prototype, and soon had a very simple snake game up and running on our living room TV via the Fire TV Stick. A "snake" comprised of green squares on a black background, a single red square representing the "mouse" or "apple", no score, no sound, nothing other than a very rudimentary snake that could be controlled via the Fire TV Remote that grew each time it "ate" a red square. My daughter loved it. I think she was excited to see that what I had been working on on my laptop had somehow appeared on the TV, and that she could press buttons to make it do stuff ☺

She referred to the snake as a caterpillar, probably due to us having played Atari's centipede on the RPi earlier in the day, and she called that a caterpillar too (I guess she has never actually seen a centipede, but has seen plenty of caterpillars). Maybe the fact we had recently borrowed The Very Hungry Caterpillar from the library had something to do with it too. Anyway, the Hungry Caterpillar name stuck, and that in turn helped me come up with a nice, bold, simple, child friendly, cartoonish skin:
Hungry Caterpillar
I could have stopped right there, as at that point I had achieved what I set out to do - I had made a little game for my three year old to play on the TV using a simple controller. However, I found the whole process of developing for a TV and remote controller quite interesting. If the game had more than a single screen, maybe a game over screen announcing when a high score had been achieved, a menu screen, a help screen, an options screen, how would all that work using the remote as a controller? More interestingly, could I get the app to work well not only on TV's using a remote/game controller, but also on the more traditional touchscreen phones and tablets? If yes, why not release it on Amazon for both Fire TV and Fire Tablet devices? Could I go one step further and release it on Google Play too? I found the answer to all that stuff and managed to build a single apk that works equally well on TV and touchscreen, and that can be uploaded to both the Amazon and Google marketplaces.

I learned a few nifty tricks that I plan to write about in future (this post is already way too long...):
  • How to suppress ads when running on an unsuitable platform (it infuriates me when ads appear in a Fire TV app with no way to avoid them or click through)
  • How to link to the appropriate app store depending on what platform you are running on without resorting to separate builds for each marketplace
  • How to handle a simple menu in LibGdx using either touchscreen or remote/game controllers
  • How to make a game/app that works well and looks good in terms of the 10-foot user interface, and that works equally well and looks equally nice on hand held devices

I also ended up with a game to play with my daughter, something to publish on the Amazon and Google marketplaces (yeah, I've been slacking again), and a reason to post on my blog again :)

Oh, and the game is totally helping TheInvaderOne get to grips with controlling an onscreen character by pressing buttons on a remote controller. She is already hitting double digit scores, which is a huge improvement over what she could manage when she first tried a couple of weeks ago. I expect she will be destroying my own high scores very soon! And if her interest in the Sensory app is anything to go by, TheInvaderOneX will be bringing more competition to the table in two or three years time! ☺

Anyway, the game is free, as always. There are some ads when you play on a mobile device (a small unobtrusive banner, and a single short interstitial plays on game over). There are no ads on Fire TV. No in app purchases or subscriptions or any kind of hidden nasties on any platforms. Just a simple fun game for you to play for free ☺
Hungry Caterpillar
Hungry Caterpillar
Hungry Caterpillar
Don't be afraid to be overly generous with your ratings and reviews, I'm cool with praise, don't worry, you won't make me blush 😙

Until next time, I hope you have fun 😀

Monday, 12 December 2016

TappyRun - infinite runner with cute voxel graphics!

I decided to spend November revisiting Unity3D, and this time I wanted to give it a proper shot. The aim was to publish a game in the first week of December... and I made it! TappyRun was released on the 4th December :)

TappyRun is a simple but fun infinite scrolling endless runner. Super simple gameplay with one tap controls, tap the left side of the screen to move left, tap the right side of the screen to move right. Avoid crashing head on into stuff or you land in the drink, at which point it's game over man, game over! It's fun to play, infuriating when you make a mistake and splash into the river, and awesome when you beat your friends highscores and share the screenshot on social media to rub their noses in it :) The closest comparisons that come to mind are subway surfers style gameplay - running in lanes collecting coins and avoiding obstacles, with a minecraft or crossy road graphical style - blocky voxel graphics, and flappy bird esque replayability and social friend baiting - quite short game sessions with the constant temptation to have "one more game" to try beating a highscore.

I intend to keep coming back to this game for the purposes of mini tutorials in the future. One month was barely enough time to scratch the surface of what Unity3D has to offer, but on the other hand it was enough to get a complete game published, so there's bound to be a handy tip or trick or two lodged in my brain worth sharing with the wider world. Interesting tutorial worthy features of this game include unlockable characters, in game currency (not purchased using real money, totally free to play), rewarded video ads, achievements, global social leaderboards, cloud saving and loading, tiles that link to my other apps formed from json retrieved from the internet, social screenshot sharing, level styling seasonal cycles, and so on. Plenty to talk about. I reckon a youtube video or two on creating cute voxel characters could be fun too! If you install TappyRun and find there's a particular feature you'd like to learn about, give me a shout in the comments and I'll see what I can do :)

Alongside creating this game I spent some time in November making a small web app with a public API that serves up useful information relating to my games and apps. Currently it just offers up information on my apps ( and web presences ( The plan is for all my games and applications to retrieve this information over the intertubes rather than have it hardcoded in each app, meaning all my apps should always be up to date. I like the idea of extending this further to help cross promote new apps to existing players, but am taking care not to rush this as it must not be annoying. I guess this isn't particularly exciting if you're just interested in playing games, but quite interesting if you're into making your own! Also, while I was at it, I couldn't resist giving the webapp a slightly prettier face than application/json text, so if you visit you should now see my fully responsive self promotional website :)

As for Unity3D vs LibGDX, well, that's a whole blog post of it's own just waiting to happen... Suffice to say they both have their pros and cons, and I will most likely be using both in future, it seems it's all about using the right tool for the job at hand.

In the meantime, what are you waiting for? Go and grab TappyRun for free from Google Play, and let me know what you think in the comments (or on facebook or twitter)!

Tuesday, 18 October 2016

Count 1 to 10

Wow... Nearly two years have passed since my last blog post! I've been busy in that time, just not publishing. Time to fix that!

My last blog post introduced sensory, a very simple cause and effect light show app. I created it for TheInvaderOne (my now two and a half year old daughter), and decided to share it with the world. It's not some groundbreaking app, it's a simple "fireworks display" that reacts to touch input - something to entertain young children and those with certain special needs (particularly children with autism). I expected maybe a couple of hundred installs and a low star rating, it was a pleasant surprise to see it at 37,000+ installs and an average rating of 4.1 out of 5!

As TheInvaderOne grows, her taste in apps becomes a little more demanding. A couple of months ago I created a simple "Count 1 to 10" app for us to play together. Last weekend I cleaned it up a little, added a few extra languages (we concentrate on English and Welsh, but I figured a few other languages like French, German, Spanish, Italian, Chinese and Japanese could be of interest to other users, and to us a little later on) and finally got round to publishing it!

The app has been kept as simple as possible so that a child can play without accidentally exiting too easily or getting bogged down in menus. It is a simple app that uses android immersive mode, and has no menu or options screens - just start the app and you're straight in. Along the bottom of the screen you'll find the number buttons 1 to 10, tap a number button to display that amount of items in the middle of the screen, hear the number spoken aloud in the chosen language, and see the number symbol overlay the item table in a large clear font. Top left is the language select button, tap to cycle through the available languages. Top centre is a volume control slider, slide left to reduce/mute the sound, and right to increase volume (note you need your device volume to be on too!). Top right is a small close button, tap this to exit the app. All settings are saved, so the next time you open the count from one to ten app your preferred language and volume settings will be set automatically.

Count 1 to 10 is a very simple app designed for young children, the main aim being to help teach early years numeracy - linking together numeric symbols, the spoken word for that number in the chosen language, and the quantity of items represented by that number. The way we use it, it also helps teach various first words relating to colours, animals, fruits, and vegetables. I don't start the app and hand the device over to TheInvaderOne to entertain herself, we sit together, tap a number button, then when a randomly generated scene matching that number appears we discuss what we see. So, say we tap "3", and as a result the word "three" is spoken aloud by the app, and three red tomatoes are displayed on screen, we'll both repeat the word "three" aloud, and she might shout out "three tomatoes!", I'd then congratulate her on getting the number and item correct, and ask for more information - what colour are the tomatoes? Does she like tomatoes? In this case the answer would be along the lines of "Mmmmmm! Three big red tomatoes! I like tomatoes! Yummy!". At this point we might go off on a tangent and talk about what we might eat with tomatoes, or maybe I'd pose a simple math question along the lines of how many tomatoes would there be if I took one away, or maybe we'd just hit another number button and start discussing the two big brown horseys, or the four little white ducks, or the eight orange carrots... This all boils down to the app being better used as a jumping off point for collaborative play/learning than a standalone toy for the child to play with on their own, though that is another valid use case for it.

I've made this app available for free on google play. Hopefully some of you out there will find it of value and leave a nice rating and review :)

I hope to be back soon with news of some more games!

Saturday, 27 December 2014

Sensory - a cause and effect light show app

While testing my latest game (Jewel Match Blitz) it became apparent that TheInvaderOne (my 9 month old daughter) was very interested in what was going on. She has always been interested in the laptop, but the phones and tablets with their sounds and bright coloured lights and tappable screens took it to another level! Testing Jewel Match Blitz soon became quite a challenge! :) I'd hand her the device to play a little, and she had great fun until it was game over - at 9 months old she was never going to be particularly great at playing a strategic action puzzle game so the game overs came thick and fast!

The experience got me thinking about what kind of app would be suitable for a baby. TheInvaderOne loves touching the screen and seeing something happen, and feedback in the form of sound effects and bright lights never fail to raise a smile. I created a very small demo app for her using the particle effect already used in Jewel Match Blitz. When you touch the screen a particle effect is triggered at that position, keep touching and more particles are triggered. The app is multitouch enabled so up to 10 points can spawn particles in assorted colours simultaneously. She absolutely loves it!

I soon realised that other babies, and potentially SEN children and adults with various learning difficulties, special education needs, and/or disabilities could also benefit from the Sensory app, so I decided to package it up and make available on the google play app store. It is 100% free and is not monetized in any way, ads in an app targeted at users with limited understanding where the aim is to randomly tap the screen would be extremely bad karma! You can find the app here -

I also figured that there are a few interesting principles involved in this tiny app that might mean it's of interest to other developers, especially those getting started with LibGdx. The app touches on particle effects, object pooling, multitouch, screen transitions, scene 2d ui, the asset manager, etc. The excellent Simple Game example touches on most of the main areas involved when making a basic game (assets, game loop, input, draw, sound). I think the Sensory app builds on that foundation to illustrate simply and clearly how to handle some of the more intermediate LibGdx features. You can find the open source project on github, hopefully it will be of interest to fellow developers interested in making games with LibGdx -

I'd be over the moon to hear that the little "side effect" offshoot of Jewel Match Blitz ended up helping you in some way, so please leave a 5* review of the app if you can (and maybe leave something in the comments here too!)

Friday, 26 December 2014

Jewel Match Blitz - Match 3 Remix!
Apologies for such a long absence, I've been neglecting my indie Android games recently. Time to put that right with a new release - Jewel Match Blitz :)

Jewel Match Blitz sees me dipping my toe in a new genre, the strategic action puzzler. From the screenshots you'd be forgiven for thinking it's yet another Bejeweled or Candy Crush Saga copycat game... But you would be wrong! :p

I grew up in a time where action puzzlers like Tetris, Columns, and Dr Mario were all the rage. Jewel Match Blitz plays more like one of those old classics than a "swap the jewel/candy/whatever positions to match 3 or more" that has seemingly been done to death in recent years. If I were to liken Jewel Match Blitz to any existing game I think Columns would be the closest match, but it's still quite a different game mechanic. In Columns the jewels fall from the top of the screen (similar to both Dr Mario and Tetris), and it's up to you to arrange them such that groups of three or more are formed and then disappear. In Jewel Match Blitz the jewels push up from the bottom of the screen, and you need to identify and tap groups of three or more adjacent matching jewels to make them explode (Match 3). You can also tap the occasional flashing blitz jewels for a blitz bonus. Your aim is to stop the jewels from reaching the top of the screen, or it is game over.

The game is available for free on the google play android market (as are all my other games) and has a global google play game services leaderboard. Download it now, sign in, get a highscore, then challenge your friends to try and beat you! It gets real addictive, real fast :D

As always, I hope you have fun!

Saturday, 19 April 2014

LibGdx Google Mobile Ads SDK Tutorial

The number one ad service being used by Android and LibGdx developers at the moment is Google AdMob.

If you've not updated your app recently you should consider doing so soon. Google says:

Android (6.4.1 and earlier SDKs)
Deprecated. On August 1, 2014, Google Play will stop accepting new or updated apps that use the old standalone Google Mobile Ads SDK v6.4.1 or lower. You must upgrade to the Google Play version of the Mobile Ads SDK by then.

Ok, so we want to migrate to the new Google Play Services way of doing things - this blog post walks you through the process :)

Install this apk to see what we'll be building!


Barebones Sample App

First thing I did was grab an up to date version of libgdx. They are now up to 0.9.9 stable, I'm sure there is a lot of awesome new stuff in there for me to investigate, but TheInvaderOne isn't really leaving me with a lot of time for Android these days so that'll have to wait!

Next I created a new libgdx project using gdx-setup-ui.jar (see this old post for a walkthrough), added a .gitignore file, and made my initial commit.

Eclipse Setup

In eclipse, import the barebones sample app (file > import > existing projects into workspace) - you should now have at least three projects in package explorer (core, android, and desktop).

Open the Android SDK Manager, download the latest SDK Platform and Google APIs (at time of writing: 4.4.2/API19), the 2.3.1/API9 SDK Platform, and from Extras - Google Play Services.

Locate the <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ directory on your machine (on my windows machine - C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib) and copy into your working directory alongside the existing libgdx projects.

File > Import > Android > Existing Android Code, Next, Browse, navigate to the local copy of google-play-services_lib in your working directory, Ok, Finish.

Right-click your android project, select Properties, Android, scroll down and click Add, select the google-play-services_lib project, Ok.

A refresh and clean in eclipse probably wouldn't hurt at this point, so go ahead and do that.


Ensure that the target in android project's file is at least 13, and the android:minSdkVersion in your AndroidManifest.xml is at least 9. Sadly this does mean users running ancient versions of Android will be excluded, but there's nothing we can do about this. There are very very VERY few devices still running versions below 2.3/API9, so at least you won't be excluding many users...

Add these two lines as children of the 'application' element:
<meta-data android:name="" android:value="@integer/google_play_services_version"/><activity android:name="" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

Add these two permissions as children of the 'manifest' element:
<uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Save changes, then refresh and clean in eclipse for good luck...

Banner Ad

See this version of the android project's MainActivity class for a reasonably straightforward banner ad implementation.

Interstitial Ad

This diff shows an interstitial ad implementation (ActionResolver interface lets us trigger interstitial actions from the core project while retaining the invaluable LibGdx cross-platform functionality).


That's all there is to it!

As always, please feel free to leave comments below. I can't really offer support - TheInvaderOne and "Real Life Day Job" leave me very little free time these days, but other visitors will often leave helpful solutions, and if I find a spare moment every now and then I do try to answer any unresolved queries.

Anyway, I hope you have fun making your games - be sure to leave a note here if you release something on google play or the amazon market, I'm always happy to check out new games :)

PS - one final note if cloning from, pay attention to the problems view in eclipse! You will need to create an empty 'gen' directory in both the google-play-services_lib and tutorial-libgdx-google-ads-android projects, and ensure you have the required android sdks installed. As is often the case with eclipse, a liberal amount of refreshing and cleaning will do no harm...

Sunday, 9 February 2014

Back with a new game - Little Fish

I've been away from the world of Android Games for a little while, but I do have a couple of good excuses:

  1. My role has changed at work and I am now a developer - this is pretty awesome. Ok so it's dry databases and stuff, not games, but I'm getting paid to do what I enjoy, and am feeling pretty good about that! It does mean more of my spare time being spent on work related learning though, so a little less time for Android Game development.
  2. Even bigger news than career change... We're expecting our first baby!!! TheInvaderOne should be delivered by the stork at the end of next month :-o Preparing for the arrival of a human worm baby takes up a lot of time, though of course nowhere near as much time as once she has actually arrived. Spending time with her will be way higher up the list of priorities than playing with Android, so I either need to drop my hobby, or make it more efficient...

What I have been doing over the past few months (as and when I found a few spare hours here and there) is working on a sort of 'white label' app built on top of LibGdx. It includes a lot of the dull and boring to implement stuff that I end up doing over an over again, highscores, user preferences, ads, facebook integration, google play game services integration, splash screen, etc. In theory I will be able to use this as a quick start platform to speed up the game production process in future. I don't currently have plans to open source this as it's a bit too closely tied to my own stuff, and decoupling would take valuable time that could be better spent making games, but maybe sometime in the future it'll be an option.

I'm hoping that this quick start platform will allow me to continue making Android Games even after baby has arrived. The recent success of Flappy Bird proves that a game doesn't have to be sophisticated to become a runaway success. At its core it's a simple game (basically a reskinned helicopter game), with simple graphics. I'm sure the developer wouldn't mind me saying a similar game could be built in a single weekend, especially when leveraging a quick start platform. I've had some success in the past with my Racing Game and Quack Attack that proves the same point, simple/fun/addictive beats complicated/polished/boring. So, in future I can focus more on game mechanics and less on the surrounding app furniture, this can only be a good thing :)

I've just published my first game that makes use of the white label quick start sausage machine (catchy name) "Little Fish". The gameplay is pretty simple - you control a little fish that eats smaller fish. Bigger fish will eat your little fish, so avoid them! There's the added complication of poison fish that you must avoid at all costs (even if they're tiny). Once you've eaten enough little fishies (empty hunger meter), you progress to the next level where you'll be a bit bigger. Of course the screen is no bigger, so dodging the predators will get harder the more you progress! Simple game, but fun and addictive :)

I've added a couple of new features to Little Fish too. First there's a kids mode, there are no gameovers in this mode (unless you choose to quit) the tradeoff being no global leaderboard score submission. I've seen lots of little children want to play mobile and tablet games recently, but when they are very small it can be frustrating losing quickly, the kids mode will help keep them happy and occupied for longer. It can also double as a training mode, once the child has mastered the more forgiving kids mode, they can try the more challenging normal mode! The other new feature is extended controller support. Not only can you choose to control the Little Fish by touch or tilt, you can also use the dpad of an xperia play (and hopefully any other android device that has a control pad) or a HID compliant external controller. The guys over at Moga recently sent me some awesome free stuff, and it was an absolute breeze to get Little Fish working with the Moga in HID mode. When I've had time to play with the Moga SDK properly I expect I'll write a blog post dedicated to that.

I hope you'll check out Little Fish and of course all my other games. As always, I hope you have fun!