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!

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!

Royal Wedding Run – New Flash Game Released

April 29, 2011

Play Royal Wedding Run

Game Description:

Good Prince William is to wed the darling Kate this very day. But he is on the other side of town! This simply will not do. Run to meet your bride, ducking old girlfriends and paparazzi on the way. Be sure to grab your princely powerups. Release the Hounds!

Additional Screenshots:

Royal Wedding Run gameplay

Here William leaps over an ex-girlfriend. He’ll have to dodge that paparazzi too!

Royal Wedding Run gameplay ending

William has reached Kate with 22 seconds to spare. The crowds at Westminster Abbey go wild!

Background:

Royal Wedding Run is a viral news game I was contracted by MTV to make for their AddictingGames arcade portal. The news event was the wedding between Prince William and Kate Middleton on April 29th, 2011.  The game is extremely silly and had a lot of humorous voice acting performed by various folks at MTV. I was responsible for the programming of the game and the artist was the talented Eric Falk.

 

Two Thousand Ten and Beyond!

January 1, 2011

Sitting here on the first day of 2011 I found it rewarding to revisit what I was able to accomplish this past year. A year is such a long time that I often forget all the projects that I’ve worked on. As the year winds down I tend to find myself wishing that I had managed to finish more games so I was happy to discover that I had published more titles than I thought!

5 Games Published in 2010

Robot Reaction released for iPhone

Robot Reaction was one of my Flash games from 2009 that I completely rewrote to work with the Flash CS5 Beta program. I was able to use the iPhone Packager for CS5 to get my first game into the Apple App Store.  It was a great learning experience in old school optimization techniques like bitmap blitting as well as a sobering business look at how hard it can be to make any money in the App Store vs the Flash business space I was familiar with.

Play Robot Reaction!

Mouth Full of Happy

While I was out at the Flash Gaming Summit and the Game Developers Conference I got to meet up with the fine folks over at the Kongregate office in San Francisco to hatch out plans for an advergame for Cheetos and Frito Lay. It was my first foray into contract advergame work and I had a great time working to create this game.  It was based off of my Orange You Glad game that people at Cheetos had spotted over on Kongregate and wanted me to create a custom version with the Cheetos theme.

Play Mouth Full of Happy!

Contentric

Feeling a lot of inspiration after my return from the Indie Gaming Summit at the Game Developers Conference I wanted to get more involved in some of the online game competitions that were run monthly over at the Experimental Gameplay Project. Contentric was created in a week for the EGP theme of You Only Have 10 Seconds and I was quite happy with the result. I was even more pleased when Armor Games decided to sponsor it!

Play Contentric!

For The Twin

Next on my hit list was the desire to finally participate in one of the competitions over at the TIGSource forums. There was a new month long competition being run with the theme of A Game By It’s Cover that had a fascinating concept to me. We were to pick a fake game cartridge whose art inspired us to think up an actual game based on the fake art. For The Twin was what I managed to come up with by using this case art.  Besides creating a lot of creepy cute art and backgrounds for the game I also composed seven faux chiptune loops in Reason for the game that came out quite well. The game ended up being sponsored by Spil Games and was played over one million times in the first month alone–a new milestone for me!

Play For The Twin!

AVOIDAL

The last game I published in 2010 was initially created for the 18th Ludum Dare 48hr game competition theme of Enemies as Weapons and polished up for the Experimental Gameplay Project theme of Zero Buttons. I went with a retro look and classic arcade gameplay for this challenging avoider collector mouse skills game. I then spent the month of October working on a final version of the game for the Ludum Dare October Challenge to sell a game in a month. Newgrounds ended up sponsoring AVOIDAL and I got to create a bunch of medal achievements that were pretty fun to try and win.

Play AVOIDAL!

Failure To Launch

I also found it insightful to take a look at all the games I worked on yet did not manage to publish for one reason or another. Many of these games are still on my todo list for 2011 and will see the light of day eventually.  Digging through my directories I discovered that I had worked on a total of 12 games this year while only publishing 5. I’m not sure if that is good or bad but it is worth keeping on eye on since I do believe in trying to finish games in order to get the most experience and value from them.

I had attempted to learn an early version of Flash Punk and I found it to be a really great Flash game framework. My efforts stalled out though with this untitled retro dodge game and I still have to learn the newest version.

I made a game in two hours for one of the crazy Glorious Trainwrecks Klik of the Month Klub #35 events called Wizards vs Ghosts which I find amusing.  Creating a game in only two hours is truly mind breaking!

I”m still actively working on a final expanded version of my 2009 Ludum Dare game called Angry Caverns and a 2009 Ludum Dare game called Fleedom. I’m still developing a pixel art arcade game called Bomb Diver as well as collaborating with another game designer/artist on a ridiculous game about pooping pigeons and bicycles.

Fun Goals And Milestones

A few of the random things I am happy about from 2010 include finally getting to go to my first Game Developers Conference as well as attending the Flash Gaming Summit the Sunday before GDC. It was a truly inspiring week spent in San Francisco and I met so many awesome game developers and Flash publishers. I am really looking forward to returning again this year.

Another great milestone was getting a New Hampshire LLC for Hybrid Mind Studios so it is all official and everything.

On the competition side of things I managed to host my first Mini Ludum Dare event around the theme of Constraints which I felt had a great turnout of submitted games and was fairly well received by the community. My game Alien Flight Academy – Graduation Day was the result of that competition. A bizarre experiment in alternate keyboard controls.

As I mentioned previously I finally had a Flash game break the one million views mark. It was a simple milestone I had looked forward to finally achieving.  2010 marks my second full year releasing Flash games and it is so amazing to look back at my first Flash game TurnStyle which was released in Feb of 2009 and only ever got about 150k plays total and compare that to my more recent games that reach millions. That fact just continues to floor me. I never dreamed that I might be able to reach such a large audience with my games, art, and music! The Flash game space offers game designers an amazing distribution opportunity that I find very inspiring, humbling, and flattering all at the same time. I look forward to trying to reach more and more people as I improve my craft.

Determined to get more involved in the local game development community around Boston I started attending monthly Boston Indies meetups and the local Boston Game Loop conference. I even started up a weekly game development co-work meetup down in Cambridge, MA at Sprout for three months to help myself meet other area game developers. It’s been great getting to know so many fine people in my neck of the woods.

Along the same lines as getting involved more locally–near the end of 2010 I had the good opportunity to take part in my first team game jam too! I was at a Boston Game Jam event called Lunar Jam and I helped out primarily as the artist doing many black and white illustrations for a choose your own adventure type visual novel game called Perchance to Dream that is still in development.

I’ve managed to work with great portals like Armor Games, Big Fish Games, Newgrounds, Kongregate, King, Spil, Addicting Games and many others. Each new relationship I establish helps me to feel more comfortable that I’ll be able to continue doing independent game development full time–my childhood dream!

Moving Forward

Looking at what I have planned for 2011 is pretty exciting to me. There are many games I’ve been working on that are nearing completion that I can’t wait to publish to see what the players think. I also want to collaborate more with other game designers, artists, musicians, and programmers. I plan to keep attending conferences like the Flash Gaming Summit and the Game Developers Conference as well as other regional and local events. I hope to keep learning new technologies, skills, and game design techniques. I look forward to building my relationships with other game developers. I have so many game ideas that the lists are growing out of control. I hope I can manage to stay focused and driven enough to get even a tenth of these new ideas out. I can’t wait to see what 2011 holds for myself as well as the other game developers out there.

Bring on the games!

Older Posts »