# How can I produce heatmaps based off of player reported data?

For a really good example of what I'm talking about, see how the developer of Replica Island does it based off of Player deaths: http://www.youtube.com/watch?v=7-62tRHLcHk&feature=player_embedded#t=37m

How can I easily produce heatmaps based off of data that I pass in?

Halo 3 is another good example of heatmap usage in game data reporting: http://www.bungie.net/Online/Heatmaps.aspx

-

Assuming you have the data set you want to plot already, and the map you want to plot it to, you can start by creating an intensity map: a grid of floating point values that is proportional in bounds to the final map (if the maps are small enough, 1:1 is probably fine). Initialize the entire array to 0.

Then you walk through each point you want to plot, map it into the coordinate space of the intensity map (which should be a simple scale operation, normally), and then plot a "blip" in the intensity map centered at that position.

A basic "blip" might just consist of increasing the intensity at the blip point plus some radius by a small amount. More complex implementations could read the existing intensity, and use a bigger falloff radius the more intense the blip point already is. You can experiment with the blip plotter to find an implementation you like the look of.

Once you have an intensity map you can use the intensity at each individual point as a 1D look-up into a color gradient, which will allow you to achieve the desired visual impact (this is how you can get the multi-colored results that are most commonly seen). You should do this color lookup as you transfer the intensity map to your final plot (rescaling, obviously, as necessary to account for size differences in the intensity map versus the final image).

This should be enough for a basic implementation, but there is room for optimization. For example, the intensity map will not be normalized, so you may need to renormalize it (probably slow) or keep track of the maximum intensity as you plot each blip, so that you can perform the renormalization of an individual intensity at the same time you are doing the recolorization. Additionally, it's possible that the distribution of your values is such that it is not memory-efficient to be storing the entire coordinate space of the map, and you may want to use an alternative solution that doesn't involve preallocating a large chunk of memory that will be mostly-empty.

If you have enough data beforehand to query the minimum and maximum intensities you expect to see in the data set you can avoid having to renormalize at all -- basically if you have some map between (X,Y,Z) to the number of "hits" of the plotted data that occurred at that point -- that's something you can build in to the system that collects the data which will help you optimize the mapping portion.

Since the intensity map is just, essentially, a grayscale image a really easy way to prototype this kind of system to use a bitmap for the intensity map and your drawing API of choice (for example, `System.Drawing` in C#) to plot partially-transparent circles to produce an intensity map. It doesn't look the best, but its functional.

-

Echo Chamber is a free logging and visualization tool specifically made for games.

Visualize SQL based data files that contain information generated by a c++ application. Information can be log statements, function calls, screenshots, or parameter lists.

View 2D and 3D game metrics such as death positions, which weapons are used most often, and memory usage over different parts of the level.

The logging system has a C++ interface (which is like a printf() that outputs to an SQL database, optionally across a network), but Echo Chamber should be able to visualize any SQL database (or it should be simple to create a database in the format Echo Chamber expects). The web site navigation is a bit obtuse; relevant Echo Chamber manual and associated Raknet logging function.

Unfortunately there is no screen shot of the heat maps in action, but Echo Chamber definitely supports heat maps:

-

For example, get coordinates on a designated event in the game. For example when player dies, you get coordinates in your scenegraph where player died.

So once you have values you need in your database, enumerate each coordinate how many times it appears in your list/database. You'll have a list something like:

• 15: 1,5
• 10: 6.15
• 3: 27,58

or whatever your values are. You'll have a frequency paired with coordinate like a key->value pair. You can then quantify key scale to a color. For example key of 0 is black and maximum key you have in your key-value list is red, and everything between is a gradient between black, mid point yellow and max point red. Quantify each result to a color and there you have it.

-
For a 3D game, or even one without integral positions, this can be further expanded by rendering circle or sphere gradients of some radius. – dash-tom-bang Aug 24 '10 at 2:17

I'm not sure if you're looking for some sort of app or an algorithm for this one. I've actually had the pleasure of building custom heat map visualization software and it's a lot of fun.

A quick Google search revealed HeatMap API which could be an appropriate solution if you don't want to roll your own.

Maybe if you explain exactly what you're looking for (application-wise or programming-wise) we can help you better?

-

Something else you could do is just output the relevant data to a CSV file or something, then import it with statistical software (like Microsoft Excel, LibreOffice Calc, R, or GNUPlot) and have it spit out a graph. If you know a little bit of shell scripting (or Batch if you use Windows), you could probably automate the whole thing.

-