Heatmaps
From PsychoStats
Contents |
Introduction
"Heatmaps" are a new feature for PsychoStats starting with version 3.1 and is supported on Half-Life (1 and 2) based game servers only (See Addons for more information on setting up your server to generate the spatial statistics required).
A heatmap is an image that is rendered from a set of spatial information that is made up of 3D map coordinates of where players kill (or "frag") other players on a map. Over time and with enough data a heatmap will show an overview of how a map is played. By looking at the "heat" in a heatmap you can see where the most players end up getting killed. If you're new to a particular map you can view a heatmap for it first to get a general idea of where the action takes place within the map and to better prepare yourself for the fight.
Installation
In order to generate heatmaps for your game server you must have the addons installed on your game server. PsychoStats comes with some addons that can log the proper spatial information that is used to create the heatmaps.
Once you have spatial statistics collecting in your stats database you can start to generate heatmaps. But heatmaps look their best when there's a lot of data available. If you only have a couple days worth of stats then the heatmaps are not going to look very interesting. After about a month of data the heatmaps will start to look a lot better.
Quick Start
- Install the proper addon from the available Addons for your game server. Support for Sourcemod, EventScripts and AMXX is included by default with PsychoStats 3.1.
- Allow a day or so to pass before continuing, so you'll have enough spatial stats to be useful.
- Run heat.pl to generate the heatmaps. The heat.pl script is included with PsychoStats v3.1 and is in the same directory where the main stats.pl script is located.
Generating Heatmaps
To generate a heatmap a special script named heat.pl is included with PsychoStats v3.1. This script is very easy to use but also has a lot of advanced functionality built into it to allow for customized heatmaps to be generated. Most users will use the basic form of this script to generate basic "Death Heatmaps" which shows where players are killed on a map.
Some other customizations available for heatmaps are:
- Animated hourly heatmaps. The heatmap GUI in PsychoStats v3.1 has a slider that allows you to view a heatmap on a per-hour basis by moving the slider back and forth.
- Heatmaps based on a particular weapon, player or team can show trends.
- Kill Heatmaps are the opposite of "Death Heatmaps", showing where players are when they kill someone.
- Combo heatmaps are special heatmaps that show both WARM and COLD areas on a map representing the locations where players are killed (warm spots) and are killed from (cold spots).
Basic Usage
The simplest way to generate heatmaps for all available maps in your database is to simply run the heat.pl script with no paramaters:
heat.pl
That will determine what maps are available and eligible to have a heatmap generated. All data available will be used to generate the heatmap (Spatial data is technically limited to about 10,000 samples; but this can be changed).
By default heatmaps will be generated with the following settings:
- Scaled down to one half (1/2 or 50%) the size of the original map image size.
- Medium brush size (25x25 pixels)
- Heatmaps are saved directly to the database (not as a file)
The defaults are configured for ease of use and allow a sane level of optimization for size and rendering speed. All heatmap settings are configurable from the 'Heatmap' section of the configuration in the ACP of your stats website. And these settings can also be changed with command line arguments to the heat.pl script itself.
Example Run:
$ ./heat.pl 22 maps ready to be processed. Creating heatmap for cp_dogblu_b3 ... Saving heatmap for cp_dogblu_b3 directly to database (29 KB) cp_dogblu_b3 heatkey='b5d4778dfd7674abd4fe7c21bc1e53383e048c77'
Advance Usage
Some advanced options are available to customize the way heatmaps are optimized. A couple of examples are shown below.
Full resolution heatmaps
By default, the heatmap settings in your configuration are not setup to produce a full res heatmap image due to the speed and size of full sized images. But if you want a full resolution heatmap you can either change your settings in the config or use the command line arguments as shown below:
heat.pl -scale 1 -brush large
Note: A full scale heatmap takes a lot longer to render (more than 4 times as long) compared to a heatmap that is scaled to 0.5 (half the size). And the size of the resulting image will be approximately 3 - 4 times larger!. While that may technically produce an image that is "twice as good" the quality won't really be noticeable for most maps and isn't worth the extra processing required.
Compare the two heatmaps below for cp_dustbowl. The one on the left is scaled to half with a medium brush size. The one on the right is full sized with a large brush. Click on the images to see the full size image; do not compare the thumbnails.
As you can see, it's hard to tell the difference. Which is why the defaults are half size + medium brush.
Cold Heatmaps
The "heat" that is rendered on a heatmap is automatically calculated from a range of colors on an HSV color wheel (from warm to hot). Alternatively, you can generate a COLD heatmap that shows colors that are cool to cold. Usually the cold color range is reserved for combo heatmaps but sometimes it's cool (pun intended) to generate a heatmap that is a bluish color instead of red.
To generate the heatmap to the right:
heat.pl cp_dustbowl -cold
Combo Heatmaps
A combo heatmap shows both hot and cold areas which usually represents where a player is killed at (hot) and where they are killed from (cold). This type of heatmap does not always look good due to the hot and cold areas canceling themselves out. But for certain maps it looks ok.
To generate the heatmap to the right you have to specify a second sample to use for the cold colors:
heat.pl cp_dustbowl -who2 killer
-who2 can be 'killer' or 'victim'. -who is, by default, set to 'victim'. So by specifying -who2 as 'killer' we get a combo heatmap. If you wanted the colors reversed you would use:
heat.pl cp_dustbowl -who killer -who2 vicitm
With that, the COLD areas would show where the killer was standing when they killed someone and the WARM areas would show where the victim was standing.
However, there lies information even in the cancelled spots. Often players both die and get kills from the same spots. The interesting thing is to get to know the spots where it's more likely to get kills than to die. Thus we combine deaths map and kills map by removing as much heat from deaths map as there is heat in kills map. In the example image it's easy to find places where red and blue spots cancel out. Those are neutral spots in respect of getting killed or getting frags. The places that have lots of blue are preferred spots because at those places players get kills but do not die often. Places with lots of red are danger zones because there it's more likely to die than to get kills.