› ~/

Game State Integration Intro


Game State Integration (GSI) is a powerful feature integrated into Counter-Strike: Global Offensive and Dota 2. It enables the sending of real-time updates of the game state to services, which can be harnessed to create applications that integrate deeply with the current state of the game.

Although GSI is officially launched for Counter-Strike: Global Offensive, there is no official information or release for its use in Dota 2. Despite this, people have still found ways to use GSI in Dota 2.

How does it work?

When GSI is enabled, the game client sends HTTP POST requests to all registered services. These requests contain information specified by the service’s configuration and the content-type of the body is JSON. During gameplay, the information is limited to the player’s or observer’s role to prevent cheating. Observers can access more information than players.

This setup is convenient because it utilizes commonly used components, such as a web server and JSON, which are compatible with most programming languages.

GSI supports both local and remote URIs, making it suitable for debugging purposes before launching a production system.

How do you enable it?

Enabling GSI is a two-step process. First, you need to instruct the game client to enable GSI by following these steps:

  1. Open Steam and navigate to your library.
  2. Right-click on Dota 2 and select Properties.
  3. Click on the General tab.
  4. In the Launch Options field, enter -gamestateintegration.

Next, you need to create a configuration file that the game client can parse. Here’s how to do it:

  1. Navigate to your Dota 2 directory for example: YOUR_STEAM_DIRECTORY\steamapps\common\dota 2 beta\game\dota\cfg\gamestate_integration\.
  2. Create a file with a name starting with gamestate_integration_ and ending with .cfg. For example, gamestate_integration_my_service.cfg.

Here is an example configuration file:

"Configuration description"
// Comments can be used
   "uri"               "http://localhost:3002/"
   "timeout"           "5.0"
   "buffer"            "0.1"
   "throttle"          "0.1"
   "heartbeat"         "30.0"
       "buildings"     "0"
       "provider"      "0" // disabled
       "map"           "0"
       "player"        "1" // enabled
       "hero"          "1"
       "abilities"     "0"
       "items"         "1"
       "draft"         "0"
       "wearables"     "0"
       "token"         "super_secret"

This file specifies the following:

Additional and more in-depth information can be found at CS:GO GSI.

Dota 2 appears to search for new configuration files each time a match starts. However, it does not allow updates to the configuration for an already configured uri unless you restart the game client.

To add comments, use // and anything following it will be ignored until a line break occurs. In order to enable data sharing, you’ll need to set the value of the specific data to 1.

The auth section is included in every request, both for local and remote uri’s. When dealing with remote uri’s, this is a great way to ensure that only authorized clients can send data to the specified service. As with the submission of any credentials, it is essential that this information is sent over HTTPS to prevent any possibility of a MITM (man-in-the-middle) attack.

Where is GSI used?

Performance impact?

Currently, GSI requires an active opt-in to be used. However, prior to March 2022, it was not necessary to specify the launch option. It makes me wonder if this change is related to peripheral companies, such as Steelseries and Logitech, requesting excessive data too frequently, simply to update some LEDs since it will impact performance.

All additional work will require extra computation, as noted by JJLiebig in this tweet.

Additional reading and sources

The majority of information regarding GSI in Dota 2 has been extracted based on the documentation for Counter-Strike: Global Offensive and via debugging. For more in-depth information, I recommend scanning through the following links.

Written by