An NPC Dialogue Plugin for Unity 4.3 – Yarn

Adding dialogue trees to your game has always been a non-trivial task until now.

Welcome to Yarn. Yarn simplifies adding NPC conversation to your game by integrating with Twine, an open-source solution for creating dialogue trees (or interactive non-linear stories as they put it).

Yarn doesn’t stop there. Yarn includes a very usable/customisable GUI that uses standard Unity 4.3 sprites and text meshes to display the conversation.

Yarn also handles Loading and Saving of the conversation history.

So give yourself a head start and get your game characters talking with Yarn!

Motorbike Trip and the future…

Just a heads-up to let everyone know I’m on a motorbike trip around Spain for the next couple of weeks. This means support will unfortunately be rather sketchy (sketchier than usual!?) for the next 2 weeks. So if you are on a dead-line and thinking of purchasing a plugin, please take this into account.

Going forward I’m thinking of bundling all the iOS/Android plugins I have (plus some I haven’t, hence the delay) into one big ‘Mobile Bundle’ and selling it at a very low price. To do this I will need to sort something out support-wise since I think it will be too much for me to handle. I’m thinking along the lines of a dedicated area for all who purchase the plugin bundle. This area will have full access to the source code, latest builds, support area for discussion so people can help each other out etc etc.

Thoughts and suggestions are welcome. Of course I will organise some sort of rebate/voucher so existing customers can easily upgrade and get these advantages.

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.

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…