Using Playtomic Analytics In Your Flash Games

July 11, 2011

Playtomic Game Analytics and Services for Casual GamesPlaytomic is a free game analytics service I have been using in my Flash games for almost two years now. It provides a real time tracking platform not only for Flash games, but also for games made with HTML5, iOS, and Unity.

Playtomic is a great way to understand how playertesters are playing your games during the development phases of your game and then to further study how your game is being played and spread around the world once you release it.  Beyond the real time analytics tools it also offers global leaderboards, heatmaps, custom game data, and level sharing APIs.

I can’t recommend Playtomic enough as it has really had a large and beneficial impact on the way I approach my game development, playtesting, and publishing. I’m not the only one enjoying Playtomic either–over 2,000 developers are currently using the service to track over 3,000 individual games, and logging an amazing billion combined real time events per day!

Playtomic Analytics Tutorial Demo

TUTORIAL

This tutorial will focus on the basics of getting your account setup with Playtomic and getting the basics of the analytics working in your game SWF.  I’ll be using the latest Playtomic API version 3.15 for ActionScript 3.0 (though Playtomic does support ActionScript 2.0 as well.) I’ll also be using the Flash IDE to create the game project but the code I’ll be demonstrating will work basically the same if you’re not using Flash. I’ll provide the source for the demo above saved as a Flash CS4 project in case you haven’t upgraded to the latest version yet.

 REGISTER FOR YOUR ACCOUNT AND CREATE YOUR FIRST GAME

Register for PlaytomicRegister:

First step is to simply register your account on Playtomic. This is pretty basic and you don’t even have to wait for an email for your account to activate.

 

 

Create Game ScreenCreate First Game:

The next step is to create your first game in the system. I’m just using a ‘Test Game’ for the purposes of this tutorial.  The important part is to hit the two radio buttons. Select ‘Casual/mobile game’ for ‘Game Type’ and ‘Web’ under the ‘Flash’  platform area. Then just click the ‘Create Game’ button and the system will bring you to the game overview screen for API setup.

 

New Game API OverviewFirst Game API Overview:

You should now be looking at the API information for the game you just created. The most important information here is the game credentials area that lists your SWFID and GUID.  You should keep these numbers private since they are the way the API will communicate from your game to the Playtomic system.

The other important areas are the documentation and downloads areas. I’ve marked everything on the screenshot to the left that you can click to enlarge. You can get to this screen by clicking on ‘API Setup’ in the vertical nav menu at the left when you are logged in on the Playtomic website.

Download the Tutorial:

Normally you’ll click on the download link for the latest Playtomic API zip file on the Playtomic website. You’ll then extract the contents of the zip and find the folder called ‘Playtomic’ inside the folder called ‘gameapi-as3′.  You’ll want to copy the ‘Playtomic’ folder into the root folder of your game project so that the folder is at the same directory level as your FLA file.

This time though I’ve already included the latest Playtomic API within the tutorial download. At the time this tutorial was written that was version 3.15 for ActionScript 3.0.

You can download the tutorial here. I saved the FLA as a Flash CS4 FLA for people using older versions of Flash still.

Extract the tutorial zip and then open up both TestGame.fla and TestGame.as in the Flash IDE.

I’m only going to point out the most important parts from the source. The tutorial TestGame.as source file itself is heavily commented and should be fairly self-explanatory. This tutorial also assumes you know the basics of ActionScript 3.0.

In order for everything to work you are going to need to have already setup your new game on the Playtomic website from the instructions further above. If not go ahead and do that now because you’ll need your unique SWFID and GUID to plug into the TestGame.as config area.


// Playtomic API constants 
// NOTE: CHANGE THESE TO MATCH YOURS OR IT WON'T WORK!
//
// SWFID from Playtomic API Setup screen
private static const PLAYTOMIC_SWFID:String = "xxxxxxxxxxxxxxxxx";

// GUID from Playtomic API Setup screen
private static const PLAYTOMIC_GUID:int = xxxx;

Before you can use the API you'll need to import the Playtomic classes. You'll see I do that near the top of the source file with the other standard Flash imports.


// import the Playtomic API 
import Playtomic.*; 

Custom Metrics

You need to init the Playtomic API as soon as possible in your game code and definitely before you call any of the Playtomic services. I usually do this with an init function of some type called during my FLA Document class constructor phase.

 

 


// Init the Playtomic API as soon as possible and
//   before you call any other Playtomic services!
private function init():void {
  // Initialize the API by logging the view
  //   this registers a 'view' on the server
  Log.View(PLAYTOMIC_GUID, PLAYTOMIC_SWFID, root.loaderInfo.loaderURL);
}

While we have now logged a 'view' above we want to track how many times the game will actually be played during that view session. In other words there should be more 'plays' of your game than 'views'. If not, the view to play ratio is a great indication that your game could use some improvement!

I typically track the 'play' event when my gameplay assets are being instantiated.


// Play the game
private function playGame():void {
  // Registers a 'play' event on the server. There can be multiple 'play' events per 'view'
  Log.Play();
  // do one time setup for game
  setupGame();
}

Custom Metrics

Another very easy and powerful thing to do with Playtomic is to track custom counter metrics. I have included an example in the tutorial. Whenever the player clicks on the 'Credits' button on the main menu we track a 'ViewedCredits' event. You can use these events to track all sorts of handy data. I usually track common things like every time the credits are viewed, the instructions are viewed, the sound or music is toggled on or off, how many times the game is restarted or paused. Basically any handy data point you'd like to gather to start understand how players interact with your game or the menus surrounding your game.


// Listens for mouse click on credits button
private function creditsButtonClickListener(event:MouseEvent):void {
  // Track a custom metric on the server so we know a
  // player viewed the credits screen
  Log.CustomMetric("ViewedCredits"); // metric, names must be alphanumeric

Level Metrics

There are many other types of metrics you can track too. I like putting in tracking for average score so that even if players aren't submitting a score I can see how players are doing with the game. You can do this with a level average metric call. When your game doesn't have individual levels you can just feed in the string 'Game' (or whatever you want) that represents the entire game and not a specific level.

In the tutorial I track a level average metric when the player hits the 'Quit' button.


// Quit game button click listener
private function quitGameButtonClickListener(event:MouseEvent):void {
  // Track the current score as a level average metric event
  //   You can track averages for specific levels or the entire game.
  //   Here the string 'Game' represents the entire game not a 
  //   particular level string.
  Log.LevelAverageMetric("Score", "Game", score);	

That's about it! The Playtomic website documentation is pretty decent and the community forums on the site are starting to mature a bit so that you can often get help from a question posted up there before too long. Once you integrate Playtomic into your own game you'll start thinking up all kinds of great uses for it. I've used the global leaderboards and level sharing APIs and will start experimenting with the heatmaps soon. I will use this base tutorial code to write up a few followup tutorials on Playtomic soon.

Let me know if I can improve this tutorial and if you have any questions at all!

[DOWNLOAD FLASH CS4 VERSION OF TUTORIAL]

Flash Game Polish Tips: Audio

July 8, 2011

HeadphonesI spend a lot of time thinking about things that will improve my Flash games. If you use sponsorship or licensing models in the Flash game business you are really marketing to two audiences–your players and your potential sponsors.

I want to provide the best experience I can to my players within a reasonable amount of effort while at the same time I also want to make sure my game is going to provide as little friction as possible to potential sponsorship or licensing.

To that end I have 5 tips I wanted to share for dealing with audio in your Flash games that I’ve found helpful:

Tip #1 – Normalize your music and sound effects

This is a very simple tip but it is too often overlooked. Normalizing is basically just making sure that the loudest volume levels of all your sound effects and music are at a consistent and good target peak.

Normalizing your audio assets before you import them into your Flash library is a good way to improve your workflow. You know that all your audio is within a consistent peak range and you can balance further with your software volume settings.

You can use a free program like Audacity to provide normalization. I’ve found the default setting of normalizing to -3dB works well.  If you are using Windows 7 you’ll want to get the beta for Audacity.

Tip #2 – Individual controls for sound effects and music

Why provide two controls? A nice thing about having independent controls for sound effects and music is that it can give the player more freedom over the experience of your game. It can allow them to keep your sound effects playing but still jam out to their own music. Another reason is sometimes the player doesn’t mind the sound effects but maybe the music is starting to get repetitive the 100th time they’ve played your chain reaction game. I look for any little tips to keep players happy and in the game and I’ve had many positive player comments from implementing this feature.

Tip #3 – Provide common key bindings for audio control toggles

Setup a keyboard listener in Flash to respond to some common keys. I like to bind the ‘S’ key to toggle the sound effects and the ‘M’ key to toggle the music.  This is a real simple touch that allows your players to quickly mute your game when they can’t find the onscreen audio controls. Remember to provide text somewhere to let your players know these settings controls!

Tip #4 – Use volume sliders for sound effects and music

The good thing about providing volume sliders over a simple mute/un-mute toggle is that your players can mix the volume to suit their individual speakers or headphones. It can be incredibly hard to master and mix your game volumes correctly so that it will sound decent and in balance across the many audio systems it will be played through. Volume sliders give the power to the players to tweak one up or down to get that balance that is pleasing to their ears.

Tip #5 – Save sound and music settings in a shared object

This last tip I have implemented most recently based on some player feedback I got. I really like this tip because it never occurred to me until I received a story from a player. The player got busted by their boss for playing one of my games in the office because they were surprised when they loaded it up again and the audio of both the preloader intro movies and the main menu music was still enabled.  They had just assumed that since they had muted the game audio the last time they had played that it would have remembered!

Well I had never really thought of this feature before but it was quite easy to implement and has been really awesome. You can use a Shared Object in Flash to track any changes to the audio controls.  You might be using one already to record local highscore data and you can just record your audio settings to this object.  Then when your game loads you can check the Shared Object to see what the audio settings were (if any) the last time they played. If there isn’t any data then you can just enable it as as default. This allows you to mute the preloader intro movies and menu music when they return if they had disabled it in a previous gameplay session!

Got any other good audio related tips? Share them below in the comments!

Three Months of BlackBerry PlayBook Game Download Stats

July 7, 2011

I’ve had six free PlayBook games available on the BlackBerry AppWorld store for three months now. I thought it might be useful to share my download and play statistics for other developers who are considering the platform.

These games have been available as free downloads since the store launched with the release of the new PlayBook tablet.

I ran a report on the total number of downloads from all six games over the past three months of time. I also gathered my analytics data from the Playtomic service which I used on each game to track views, plays (number of plays per view), and average playtime length per view. I also used Playtomic to provide the global leaderboards.

Using this data I built the following graphic (click to enlarge):

Hybrid Mind Studios BlackBerry PlayBook Game Download Stats

I should also mention that five of these six games have been fairly popular and all within the top 25 lists of their respective free categories. They’ve all been well reviewed (when reviewed at all) and I’ve done next to no promotion of them. These downloads basically represent players discovering the games through the PlayBook AppWorld interface.

You’ll note that I tracked the review percentage. This represents the amount of reviews I received per game based on the number of downloads.

It was pretty easy to convert my existing Flash games over to work on the PlayBook. Besides receiving a free PlayBook for the first game as part of BlackBerry’s launch promotion I was also fortunate enough to be compensated as part of a contract for my conversion on the other five games too. This allowed me to release them for free to study the market in the most favorable of download circumstances.

That said, if I wasn’t being compensated for my efforts I would not find these numbers to be very encouraging at all! Each game was only downloaded an average of 1300 times.  That number would be far, far smaller if I was charging for these games. That is not a good indication that I’ll be attempting to pursue this market further unless new changes or information comes to light–I simply can’t afford to make that kind of super risky business decision with my time.

I’ve enjoyed the free PlayBook I received from BlackBerry. It is the first tablet I’ve owned and it seems to be a fine enough device. I am not a heavy tablet user though and have little to compare it to besides having used an iPad for a bit. I’d be curious to see other developer’s download numbers (and even sales data) on the PlayBook device. Anyone making any money?

Turd de France – New Flash Game Released

July 6, 2011

Play le Turd de France

Game Description:

Angry birds? Try angry pigeon! You play a French pigeon that has had it with all the crowds and traffic generated by le Tour de France. You set out to disrupt the last two minutes of the bicycle race the only way you know how–by pooping all over the place! Cause massive pileups with the power of pigeon poop!

Play le Turd de France!

Additional Screenshots:

Mega Poop powerup acquired!

Here you have just acquired the Mega Poop powerup!

Mega Poop unleashed!

Unleashing the fury of the Mega Poop!

Scoring triple direct hits!

Scoring a sweet triple direct hit! Direct hits increase your multiplier and let you score big.

le Turd de France race is ending!

The race is wrapping up! I’m pretty sure you made your point with the bicyclists…

Game over screen with many race stats

The race has finished! Here you can review all those critical race stats.

Background:

This game was a very silly collaboration I did together with fellow game designer Joshua A.C. Newman of the glyphpress. It was inspired by his friend Judith Shaw who got pooped on by a pigeon while riding her bicycle. Joshua is an avid bicyclist and he contacted me to see if I wanted to help bring that incident to life as a video game.

We thought basing it around le Tour de France would be a funny way to provide a setting with plenty of opportunity for humor.

Of technical interest would be the fact that the peloton of bicycle racers is controlled by a heavily customized version of Boid’s flocking algorithm. Each biker dodges the poop splats on the ground as well as the road edges and the other bikers–all the while trying to reach a target point toward the right of the screen. I also added a 5-state internal bicyclist model that controls their stamina and energy and allows them to try to reach the front of the peleton before tiring out and drifting to the back of the pack.  It took a few days of heavy playtesting to tune the flock algorithm just right to make it fun but it is so great to watch that the intense effort was well worth it!

Give it a play over at AddictingGames!