Tuesday, 2 June 2020

Hello again, World...

I've neglected this little corner of the web for nearly three years, shame on me!

A lot has happened in that time. I was promoted at work (Yay!)... Then I was made redundant when the company folded (Boo? Hiss? Maybe, maybe not, I'm undecided...). Our children celebrated some birthdays - our eldest is now 6, and our youngest is 3. I suppose we got a little older too, but the less said about that the better! I've taken care of some real world projects - mostly satisfying physical work involving wood and concrete and hand tools and sweat. Oh yeah, and the whole goddamn world has been turned upside down thanks to a global pandemic. Fun times!

When I've not been homeschooling the girls, hiking in the amazing countryside that is rather conveniently situated right at my doorstep, completing practical projects around the house, reading all the things, and vegetating in front of netflix, I have been pratting around with my fingers on a keyboard tinkering with various software projects.

Absolute emphasis on TINKERING.

There has been little in the way of reasoning behind what I've been messing with other than "I am currently the master of my own destiny, I have some technology on hand, a brain that needs exercise, and although the libraries are sadly shut we do have an amazing resource called t'interwebs on hand these days, so why not just have some fun". Sure, keeping my brain active and tinkering with Java/Go/JavaScript might have some practical benefits when it’s time to find a new job, but that's as far as it goes. My mindset is firmly back to that of my 10 year old self, hacking away on a ZX Spectrum programming Sinclair Basic just for fun :D

So, what software projects have I been fiddling with, you might ask... Well, there are a great many, but here's the top ten (ok, ok, it’s less a top ten and more a list of things I've worked on most recently and/or not already forgotten about). In no particular order:

1) I started (well, nearly finished) working on my very own retro style minimal Simple RPG. I don't really know why I've not finished it if I'm honest. Developers and their goldfish-like attention spans eh? I'll probably blog about this project separately and add a link (or maybe forget to add a link) here when I do.


2) I rewrote theinvader360.com in Go. Almost entirely pointless, it could quite happily be a static site, but I wanted to so I did :) Yes, you *will* see a pattern emerge in my justification of how I choose to spend my limited time on this planet...

http://www.theinvader360.com

3) I actually released something on Google Play! Don't get too excited, it's just a Maths Quiz ;) Our eldest loves a maths challenge, and she responds massively well to gamification - anything where she can score 10 out of 10 is a winner. This app was built with her firmly in mind, no countdown clocks or pressure to "guess" the answer, just a simple ten randomly generated questions and taking your sweet time to answer correctly kind of deal. She's consistently scoring 10/10 on each challenge type now, so maybe something with a bit of hazard/risk is called for next... Although it’s a fairly boring "game" to look at, it was actually quite good fun to write. I might write more about it sometime, and maybe try to remember to link to it here...

https://play.google.com/store/apps/details?id=com.theinvader360.quiz.maths

4) I wrote a procedural maze generator and cobbled together a basic maze game. I never got round to polishing and releasing the app, but it’s installed on the living room fire stick and the girls like playing it every now and then :)


5) I fiddled about with PyGame and built a Lunar Lander game. This project was kicked off at a local nerd club gathering back when such things were possible, great fun! Oh how I miss being quiet and antisocial in a room full of grown adults, it’s just not the same being quiet and antisocial in the comfort of your own home.


6) My six year old and I collaborated on designing a rule set for a pen and paper tabletop game (SiTTeRS). I had originally planned to turn this into an app, but figured we liked it as it was - a low tech, two players in the same room, real time, physical pen and paper and a dice kinda deal, so I dropped the computer simulation aspect and kept it strictly low tech.

https://github.com/TheInvader360/SiTTeRS

7) Nothing at all to do with games, but I wrote an extremely minimal headless Go application fronted by an equally minimal Vue.js frontend. Not particularly useful - you can achieve the end result as it stands in vue alone, but I liked getting the two parts to work together.

https://github.com/TheInvader360/checklist-frontend-vuejs

8) I built a very simple Memory game using Go and the Ebiten library. I’ve built an executable to run on my laptop, and an apk to install on our various android touch screen devices. This isn’t destined for proper app store release, but feel free to grab it from GitHub!

https://github.com/TheInvader360/simple-memory-game

9) I started building a small Dungeon Sweeper game. No idea why I didn’t finish this, I probably should at some point, the scope is super tiny compared to the Simple RPG mentioned up top. It would also make a nice little fantasy console game. I might come back to this at some point...


10) I read about the Pico-8 a while ago and found the whole subject of fantasy consoles to be quite fascinating. I’d have killed for that kind of dev environment back in my Spectrum days! Then a couple of days ago I discovered the TIC-80... It’s free as in beer, free as in speech, and it supports JavaScript... Sold! I ported a nice Pico-8 tutorial to the TIC-80, and in a single day I had a crappy “game” that could be played on the living room TV using an Xbox One controller, and via the web using keyboard controls (cursor and “z” keys replacing the d-pad and “a” button). I can see myself spending a lot more time tinkering with these fantasy consoles :)

https://github.com/TheInvader360/explore-tic80-js

It strikes me that most of the projects I've enjoyed playing with recently have been quite small and short lived. I've aimed to spend only a day or two's worth of spare time on each, with the aim of getting something minimal and functional finished in that time. Pretty much the Ludum Dare rules really. This has been the case with pretty much everything other than the unfinished simple RPG game (no matter how “simple”, it’s still nowhere near a weekend project!).

I have lots of ideas for future projects. I’d like to finish the Simple RPG and Dungeon Sweep games at some point. I might write a completely pointless static blog/CMS engine, just because (add it to the heap of others out there that nobody wants or needs) :D I’d like to write some Spectrum / NES / Game Boy ROMs (maybe some remakes or demakes). I’d also like to see if there’s anything fun I can do with some of the old hardware we have lying around (Spectrum, Game Boy, DS, PS2, PSP, Wii, etc). I have a Raspberry Pi 3 that is pretty much a dedicated RetroPie machine - it gets played with more than the Xbox One, but maybe I should do more with it. If I’m feeling particularly masochistic I might spend some time on lower level stuff than I’m used to, maybe some assembly is in order :) I’d also like to spend some more time playing with fantasy consoles like the TIC-80, just because it’s fun...

Then there’s the huge subject of moving on from teaching our children traditional languages, science, and maths, and sprinkling in a little bit of computer science. There will be some Scratch and Python in my future for sure, and I can’t imagine any better teaching method than making games. It’s gonna be fun! :D

So yeah, I’m still alive, I’m not really focused on publishing new games to Google Play any more, but I do still love making and playing games and little educational doodads and thingermawotzits.

Until next time, au revoir!

Thursday, 26 October 2017

Greedy Caterpillar - a snake game for touchscreen and TV


Snake

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!

https://play.google.com/store/apps/details?id=com.theinvader360.tap.run

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 :)

https://play.google.com/store/apps/details?id=com.theinvader360.tap.run

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 (http://www.theinvader360.com/api/v1/apps) and web presences (http://www.theinvader360.com/api/v1/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 http://www.theinvader360.com you should now see my fully responsive self promotional website :)

http://www.theinvader360.com

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

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

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.



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

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.

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

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!

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...