Posted on by

We are proud to announce a new Corona Plugin partner: GameAnalytics!


Annamaria (GameAnalytics)This post is by Anamaria Todor, a software engineer at GameAnalytics. She focuses on maintaining a close dialogue with customers and making sure the product is tailored to their needs. Formerly an editor, Anamaria has spent several years reviewing and performing cultural analyses on triple-A games. Ana did her undergrad studies in both Cultural Studies and Software Engineering, and she is now doing research for her master’s thesis on recommender systems for the MSc in Computer Science (Digital Interactive Entertainment track) program at Copenhagen University.


GameAnalyticsIn the darkened room, a providential click suddenly splits the silence. It’s the celestial cry of that last commit to the code base. Programmers everywhere sigh with relief as they visualize their “baby”, that game they spent more than six months on, coming to life. Becoming independent, surpassing their masters and most importantly, giving those masters their life back.

Or is it? If you believe your connection to the game you just developed severs the closer you get to release, think again. This is the curse of development, being trapped in developer limbo. To stick to the “baby” analogy, near release your game resembles a rebel teenager, one you need to understand in order to get back on track. Closing your eyes and keeping your fingers crossed will never make it better and will most definitely not make it sell, no matter how great the idea and the “genes”. To turn your game around you need facts, you need figures and you need to ACT. All in all, that is what GameAnalytics is all about; improving your digital parenting.

So, who are we blokes exactly?

GameAnalytics is a completely free online service, created for developers who want to know their games better and who also want to know how to know their games better. By tying GameAnalytics to your game data, you can immediately get insights into how your game performs by consulting basic automatically generated industry-standard metrics, such as DAU, MAU, ARPPU, ARPDAU, etc. If those acronyms look like hieroglyphs to you, no need to worry. We explain everything both on our blog and on our comprehensive support forums.

Put some more time into your integration and you can rely on GameAnalytics to tweak all aspects of player experience, from the tutorial flow to in-game item prices, level timers and difficulty. GameAnalytics can also be a team experience through its minimalist, customizable dashboards and targeted email reports. It’s really up to you to define the boundaries of the integration.

Of course, we wouldn’t be on this blog without a good reason, so I’m delighted to announce that GameAnalytics is now also an official Corona partner (we have our own plugin section and all). This means that setting up your Corona-developed game with GameAnalytics is now a matter of just a few minutes. Moreover, the official plugin taps into some of Corona’s unique features and is able to automatically track:

  • system information
  • average and critical FPS
  • error stack traces
  • memory warnings (iOS only)
  • storyboard scene changes

But I’m not here to sell; I’m here to show and tell. If you want more details about what GameAnalytics does, please visit this link. Otherwise…

If you want to sit back, you can watch this video which walks you through setting up GameAnalytics and integrating it into one of the example applications provided by Corona.

OR

You can read through the GameAnalytics setup walkthrough below, filled with copy paste code goodies and what not. Best way to learn, if you ask me…

Let’s get started

In order to get started with GameAnalytics, you first need to make sure that you are registered with the service. You can sign up on the GameAnalytics website directly, after which you will be prompted to create a studio and a logic game entity. These are absolutely necessary for you to start sending data our way, because they provide you with an unique identifier for your game – the game key – and your own encryption key that ensures no one else can intercept and understand your data – the secret key. Here’s a screenshot of my Corona game entity, together with the attached keys:

Screen Shot 2014-01-20 at 3.33.34 PM

The Example

The Basics

As much as we would have wanted to blow you away with the most awesome example of integrating GameAnalytics into a live Corona game, the open source examples available are a bit too outdated to really have educational value. Moreover, they are less accessible than the Sample Apps that already come with Corona.

That’s why, to illustrate the power of GameAnalytics, we chose the SimplePool example available in the SampleCode / Physics / SimplePool directory.

To use GameAnalytics in your game, first modify the build.settings file of your project to include these lines under “settings”:


	plugins =
	{
		["plugin.gameanalytics"] =
		{
			publisherId = "com.gameanalytics",
		},
	},

The complete SimplePool build.settings file would look like:


settings =
{
	orientation =
	{
		default = "portrait",
		supported = { "portrait" }
	},
	plugins =
	{
		["plugin.gameanalytics"] =
		{
			publisherId = "com.gameanalytics",
		},
	},
	iphone =
	{
		plist =
		{
			CFBundleIconFile = "Icon.png",
			CFBundleIconFiles =
			{
				"Icon.png", 
				"Icon@2x.png", 
				"Icon-72.png", 
				"Icon-72@2x.png", 
			},
		},
	},
}

Next, configure the application to use the GameAnalytics package by requiring the GameAnalytics package inside your code and then by initializing it with your corresponding game and secret keys, as well as a desired build number. For this particular game, this means that I have to add the following code just below the physics initialization:


local physics = require("physics")
local GA = require "plugin.gameanalytics"

GA.init ( {
       	game_key = '797e949fd13cf58ef1a98255bf9345825',
       	secret_key = '64b58b4f0de247c61a9df9121d970d93f8cd3f09',
       	build_name = "0.1",
} )
physics.start()

Believe it or not, that’s it. You can already check if the GameAnalytics package works and sends data to the servers correctly. For this, enable debugging mode, set the option to allow the application to send information from the simulator and enable the submission of System Information. Don’t forget that you have to set all these flags BEFORE initializing the SDK:


local GA = require "plugin.gameanalytics"
GA.isDebug = true
GA.runInSimulator = true
GA.submitSystemInfo = true
GA.init ( {
       	game_key = '97e949fd13cf58ef1a98255bf9345825',
       	secret_key = '64b58b4f0de247c61a9df9121d970d93f8cd3f09',
       	build_name = "0.1",
} )

You can view the debug logs both in the simulator and on actual devices. For the Mac, start Corona SDK using the “corona-terminal” app in the Applications/CoronaSDK folder and then open your application. On a PC, Corona SDK will start up a cmd shell screen for you. The print messages will be shown there automatically.

If you want to view the messages directly on your device, follow the steps outlined here.

For example, this is my terminal window on Mac OSX:

Screen Shot 2014-01-20 at 3.35.24 PM

This shows that the GameAnalytics plugin has been correctly initialized.

Screen Shot 2014-01-20 at 3.35.57 PM

The {“status”:”ok”} message in the screenshot here shows that the messages are being correctly received by the servers.
Of course, once the messages have been successfully submitted to the GameAnalytics servers, you can also view them in the Realtime tab of the GameAnalytics tool:

Screen Shot 2014-01-20 at 3.36.42 PM

Some Advanced Behavior

Now that you know that GameAnalytics actually works, let’s make tracking more interesting. Let’s say you also want to track the actual performance of your app by looking at average FPS. Add these settings BEFORE initializing the GameAnalytics SDK to send FPS data every 10 seconds:
GA.submitAverageFps = true
GA.submitAverageFpsInterval = 10

In the terminal, you can see that events are indeed being sent out every 10 seconds:

Screen Shot 2014-01-20 at 3.37.33 PM

And this is what you get in the quality dashboard:

Screen Shot 2014-01-20 at 3.38.09 PM

So far so good. Let’s get custom!

For this, we need to have a look at the actual SimplePool application anatomy.
The app consists of the following sections:
a splash screen which gives you the choices to play either a one-player or a two-player game and to access the game options
an options screen which allows you to change the pool table color
the actual game screen which is your classic pool game.

It’s a rather simple application, but still there are a lot of interesting aspects that could use some tracking. For example, we would like to know

1. Do players prefer single or two-player matches?

This would help you understand where your game excels: is it a better single player experience or a multiplayer one? To answer this question, you could create the following event hierarchy:
GameLaunched:onePlayer
GameLaunched:twoPlayer
To get this into the GameAnalytics tool, you could insert this code in the init() function:


	if mode == onePlayer or mode == twoPlayer then

		if mode == onePlayer then
			GA.newEvent ( "design", { event_id = "GameLaunched:onePlayer" } )
		else
			GA.newEvent ( "design", { event_id = "GameLaunched:twoPlayer" } )
		end
		timer.cancel(buzzTimer)-- Removes buzzing animation
	end

In order to visualize this, we should create a custom widget in the GameAnalytics dashboards. Here are the settings for the widget:

Screen Shot 2014-01-20 at 3.38.56 PM

And this is how the final widget looks:

Screen Shot 2014-01-20 at 3.39.48 PM

2. Which table color is the most popular?

In case you ever want to start selling different table colors, knowing which one is the most popular would definitely help. Use the following event hierarchy:

TableColor:ColorID

Note that the ColorID can actually be assigned automatically from the code, using string concatenation. Put the GA call in the OptionMenu() function, under the changeFelt() function:


	local function changeFelt(event)
		local feltObject = event.target
		local feltColor = event.target.id
		if event.phase == "ended" then
			GA.newEvent ( "design", { event_id = "TableColor:".. feltColor } )

This widget is set up similarly to the one above and it will look something like:

Screen Shot 2014-01-20 at 3.40.32 PM

3. Statistically, how many balls are left on the table when the eight ball is accidentally scored and the game is over?

Knowing how many balls are left on the table can give you an idea on how hard the game is. Maybe you want to “tweak” the black eight ball to change the game difficulty. You can track this metric from the gameOver() function:


function gameOver()
	if mode == onePlayer then
		GA.newEvent ( "design", { event_id = "GameOver:onePlayer:BallsOnTable" , value = 7 - solidTotal } )
	else
		GA.newEvent ( "design", { event_id = "GameOver:twoPlayer:BallsOnTable" , value = 14 - stripeTotal - solidTotal } )
	end

Here’s how you would create a custom widget for this data:

Screen Shot 2014-01-20 at 3.41.18 PM

And for my first attempts, the results would look something like:

Screen Shot 2014-01-20 at 3.42.07 PM

To Wrap Up…

Of course, in this article I have just scratched the surface of what can be achieved with the GameAnalytics SDK. To understand the complete capabilities of this plugin, please visit our documentation.


Posted by . Thanks for reading...

8 Responses to “New Plugin Partner: Introducing GameAnalytics”

  1. Mo

    Great stuff! It seems that GA is much faster as reporting events than Flurry or am i mistaken? I like Flurry but I can stand waiting for the events to show up in the dashboard. Can’t wait to try it!

    Mo

    Reply
    • Anamaria Todor

      Well, drawing direct comparisons would not be fair, but with GameAnalytics you get direct feedback in the Corona editor through the debug messages. If you get “{status:ok}” messages then you know for sure that your messages have reached the GA servers.

      Reply
  2. Andreas

    Looks quite interesting! I’m not too happy with Flurry, so I might give it a try.

    One question for Android:

    Are more permissions needed than “android.permission.INTERNET”?

    Thanks & best,
    Andreas

    Reply
    • Anamaria Todor

      Thank you both for your interest in GameAnalytics. We really appreciate it!

      @Mo: Well, drawing direct comparisons would not be fair, but with GameAnalytics you get direct feedback in the Corona editor through the debug messages. If you get “{status:ok}” messages then you know for sure that your messages have reached the GA servers.

      @Andreas: it only uses “android.permission.INTERNET” and “android.permission.ACCESS_NETWORK_STATE”.

      Reply
  3. Tyler

    So, I just spent the last few hours integrating GA into my current project. Looks good. But I have one question regarding viewing the “real time” screen on the GA site for my project analytics. At the top it shows a box for current active sessions. I’m only running my app in one single simulator, but that active session count goes from anywhere from 0 to 4. So, I’m confused how/ why this isn’t just showing 1.
    Also, I have to say, that I’m still confused about how to structure some of my messages (whether to rely on the ‘area’ or to include the area data as part of the sub string for the message, etc.. ). It is nice that I have access to the real time section, to make sure messages are getting there, but it sucks that I can’t see how my messages will look in the reports, until 24 hrs later. It would be very helpful to see how they would look and correlate, etc, right away, so I can make decisions on the structure I’d like to use for these.

    Reply

Leave a Reply

  • (Will Not Be Published)