Google Play Game Services Unity Plugin for Android now Available!

The plugin names get longer, kinda like the summer days here in England. Unlike a typical English summer day however, this plugin supports the following:

  • Achievements
  • Leaderboards
  • Cloud storage (ok english summer days do have clouds)
  • Realtime Multiplayer

The plugin also works in both Unity 3.5 and 4.

Get the Google Play Game Services Unity Plugin for Android here.

7DRL , a couple of ‘reviews’…

Just found some time to play a couple of the roguelikes from the 7DRL challenge. These are not reviews as such, just initial impressions from a single play through. Congratulations to everybody who took part in the challenge whether you finished or not, I found it a complete blast and definitely doing the next one.

Rodney

RodneyInGame

 

Loved my play through of this little game. The skill unlock system was cool, nice inventory system, simple controls, played directly in the browser with an online leaderboard… brilliant (I’m MOG at the bottom ;-( )!

RodneyHighScore

 

I found the first few levels pretty easy got cocky and died suddenly. That just makes you want to have another go! Well done slashie.

Rogue Break

RogueBreak

What a nice looking game! Cool little windows for the minimap and message log and easy to use inventory system. Haven’t got very far in it yet but definitely going to go back to it. Sound would be a nice addition, I think I expect sound when I see something looking this good! Good job rbandrews.

7DRL Challenge

I’ve entered the 7DRL Challenge, my game is called ‘Faith in RL’ and is a roguelike where the main mechanic is conversion. So you want to get the monsters in the dungeon to kill each other! Have no idea if it will be fun (it’s not at the moment ;-( ) but if I keep adding and tweaking maybe it will be.

I’m hoping by the end of the week I will have a decent(ish) game and perhaps more importantly and good basis for a roguelike template in Unity. Fov is already working quite nicely but there’s lots more to do…

Handling coins, virtual currency, points, beans(?!) etc in the In App Purchasing Plugin

I’ve had a few developers ask me how to handle stuff like virtual currency in my In-App Purchasing plugin. Out of the box it handles ‘Managed’ items like extra game levels, new swords, santa hats of health ;-) etc with ease. However ‘UnManaged’ items that can be purchased multiple times tend to be a little more specific to your game. You probably already have a virtual currency variable, like ‘coins’, somewhere in your code and you just want to increment this by say 100 when someone purchases a productid of ‘coins_100′.

Well luckily this is really simple to do. After a person purchases a productid in your game, the plugin will automatically call ‘OnPurchaseResponse’ on a script attached to the ‘UnityGameObjectReceiver’ gameobject. In the demo scene I use this fact to call ‘UpdatePurchase’ to record when a ‘Managed’ item has been purchased. This can be easily extended to handle your ‘UnManaged’ items in the following way:

public static void UpdatePurchase(PurchaseInfo purchaseInfo){
  if(purchaseInfo==null) return;
  Debug.Log("OrderID:" + purchaseInfo.orderId + " productId:" + purchaseInfo.productId + " purchaseState:" + purchaseInfo.purchaseState);
  if(purchaseInfo.purchaseState == "PURCHASED"){		//If a purchase then add to list of purchased items
    //Put any Unmanaged items here
    if(purchaseInfo.productId == "coins_100"){
      GlobalStuff.coins += 100;
    }
    //Managed Items
    if(!Instance.PurchaseInfos.Contains(purchaseInfo)){//Don't add again if this orderid already exists
      Instance.PurchaseInfos.Add(purchaseInfo);
      Save();//When you purchase an item, immediately save to file
    }
  }
}

Where ‘GlobalStuff.coins’ is your virtual currency variable, for example I tend to stick all my ‘globals’ in a ‘GameStateManager’ static class and expose them as static properties, so mine would actually be ‘GameStateManager.Coins’.

Note that you will probably want to save those precious coins for your players in between game sessions. PlayerPrefs is a good way to do this…

Hope that all makes sense. Of course this post covers the Android version of the plugin, however the iOS version is almost identical so can be amended in a similar way.

One Game A Month!?#

So I’ve decided to take the One Game A Month challenge. I’ve dedicated a whole menu item to it (yes, that serious ;-) ) and hopefully that will slowly fill out with 12 games…

Still going to work on larger games as well, in fact I may use the 12 smaller games to test out ideas that will go into the larger games.

The sort of things I need to test out and learn are:

  • A* Path finding
  • Turn-based style game structure
  • More complex AI
  • Emergent behaviours from simple rulesets
  • Procedural Content Generation

There’s probably more but that will do for the moment. So hopefully my smaller games will incorporate some of the above so I can learn and create at the same time.

As you can probably tell from the above list, my interests like firmly in roguelikes at the moment. Some examples of roguelikes are:

To find out more, a good podcast is Roguelike Radio. Worth checking out if you are a budding game developer.

Of course after saying all that, my first game is a simple tower building game, I wanted to start simple and just get used to a newer, more open way of working…

 

Test Ads in the Android Admob Unity Plugin

If you have an application all set up with the Android Admob Unity Plugin and you want some test ads so you can test clicking and such without upsetting Admob, here is how to do this.

First you will need your ‘Test Device ID’. The only way I know of to get this is to check the logcat in Eclipse while you device is plugged in (and running your game with Ads showing), search for a line that looks like:

To get test ads on this device, call adRequest.addTestDevice(“Your Test Device ID”);

After you have the device id, add the following method to the AdMobUnityPlugin class:

public static void SetTestMode(string test_device_id){
  AndroidJavaClass jc = new AndroidJavaClass(classname);
  jc.CallStatic("SetTestMode",test_device_id);			
}

Then this should be called before you call StartAds(), i.e.

void Start(){
  AdMobUnityPlugin.SetTestMode("My Test Device ID in here");
  AdMobUnityPlugin.StartAds();
}

That’s it, you should now get test ads. Obviously please remember to remove the call to the SetTestMode method before you deploy for real, however if you forget you can disable test mode in your application settings on the Admob website (just below where you can set the refresh rate).