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!

https://play.google.com/store/apps/details?id=com.theinvader360.jewel.match.blitz.game.free.android

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!

https://play.google.com/store/apps/details?id=com.theinvader360.sensory.app.free.android

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 - https://play.google.com/store/apps/details?id=com.theinvader360.sensory.app.free.android

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 - https://github.com/TheInvader360/sensory

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!

https://play.google.com/store/apps/details?id=com.theinvader360.jewel.match.blitz.game.free.android
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

https://play.google.com/store/apps/details?id=com.theinvader360.jewel.match.blitz.game.free.android

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.


AndroidManifest.xml

Ensure that the target in android project's project.properties 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="com.google.android.gms.version" android:value="@integer/google_play_services_version"/><activity android:name="com.google.android.gms.ads.AdActivity" 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 https://github.com/TheInvader360/tutorial-libgdx-google-ads, 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!