Dota 2 Demo Format

From Valve Developer Community
Revision as of 13:34, 27 April 2012 by Barracuda (talk | contribs)
Jump to: navigation, search

demoinfo2.exe is a tool that will parse Dota 2 demo files (ending in .dem) and dump out every message in the demo. Using this tool, third parties can parse the demo for various game events to generate information and statistics.

You can download the binary and source code for demoinfo2.exe here.

You can use demoinfo2.exe by itself and parse the demo. We have also included the source code to the program itself to show how to parse and retrieve information directly.

Dota 2's demo format is built around using Google's Protocol Buffers (protobuf). Protobuf is a message/object serialization language that generates code to serialize the objects efficiently. If you wish to understand more about protobuf, check out

In order to build demoinfo2 yourself, you will need Visual Studio 2010. You will also need to download Google's protobuf and snappy libraries.

  • Extract and it will make a new folder named "demoinfo2".
  • Download protobuf and install this directly in the protobuf-2.4.1 directory that was created when you extracted demoinfo2.
  • Open protobuf-2.4.1\vsprojects\protobuf.sln into Visual Studio 2010. You will be asked to convert it, please do so. Once loaded, select Release version from the build target in the toolbar. Build the libprotobuf project by right clicking it in the solution list and hitting "build." You do not need to build the other protobuf projects.
  • Download protoc (the protobuf compiler) and extract this into the protoc-2.4.1-win32 folder that was created when you extracted demoinfo2. This is the protobuf compiler that parses .proto files and generates C++ code to parse the messages in the demo file.
  • The last library needed is Google's snappy compression library. Download it from here and extract it into the snappy-1.0.5 folder.

Once those libraries are installed, you can now open demoinfo2.sln and build your own demoinfo2.exe binary. Select the Release build target from the toolbar and hit build! You will have a new binary in demoinfo2\Release\demoinfo2.exe.

To parse a demo, just download one in Dota 2. They will be in C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\dota\replays\*.dem. To dump a demo, just run "demoinfo2 xxx.dem" and it will print out all the messages in the demo.

Google's protobuf can generate parses in Java and Python using the same .proto files. People proficient in those languages can use protoc.exe to generate code that parses the protobuf messages and parse the demo file in those languages.

We are curious to see what people come up with using this tool and please do post questions and comments about it on the Replay section of the Dota 2 Development Forums.