Game Analytics in C++

Update: There was a pretty dumb typo in Logger.cpp that was causing stack corruption and other fun things I didn't catch until I ran in Debug mode. It's fixed now.

I recently decided that I wanted to collect playtesting analytics for a game I'm working on, and went off in search of a good system. I wanted a service that I could implement in C++, send events to a server, and have that server parse it into useful data for analyzing. This...turned out to be harder than I thought. I ran into several dead ends, usually because the service didn't support C++ or because it had become a creepy sort of ghost town.

Finally I discovered, a relatively new site that had everything I wanted. And while it didn't have a C++ implementation it had the next best thing: documentation for the REST API. So after much blood, sweat and tears I finally had a kickass logging system in place, complete with retrievable heatmap data that I can draw in-game. And I decided to share this implementation with the world!

First, I highly recommend you check out and get a feel for the system, and the features they offer. Here's an overview of their services, and here they are in more detail. Once you've gotten a sense of how the website works and have created an account, you can start working on adding it to your game.

My implementation is pretty basic. It offers you the ability to add an event to a queue, send all queued-up events to GameAnalytics, and retrieve heatmap data in the form of a collection of points and values. You can freely peruse and download my source code at I did my best to bombard it with comments, so hopefully you can read through the source code and get a good understanding of what's going on. It's not quite ready to be an SDK or standalone library, but it should give you a great head start on using GameAnalytics in your own code.

Here are all the resources you'll need to get it working:

As I will likely be using this service for quite some time, I'll do my best to update it and hopefully make it better and better. For now, I hope this is a decent head start!

- Jason Ericson

No comments :

Post a Comment