Home

Awesome

Alice

Efficient Dota 2 replay / demo parser written in C++.

Alice comes in two flavours, core and addon:

Both flavours have the same dependencies:

Alice supports the following operating systems / compilers:

Additional compilers might be supported but haven't been tested.

License

Alice is licensed under the Apache 2.0 License.

Replay Data

Alice provides access to the following data:

You are required to subscribe to the data / events you would like to receive. Alice skips any data that doesn't have a subscriber for performance reasons.

There are certain parts of the replay which no one has figured out yet. Alice provides full access to them in the following manner:

Performance

Alice is heavily optimized and can parse the majority of replays in less than a second. A standard 45 minute public replay takes about 500ms.

The following settings are available to further tweak the parsing process (with the recommended settings in brackets):

Longer replays often have more messages than their shorter counterparts in the same skill-bracket. Games with in different skill-brackets and different game modes have more / less messages depending on factors such as spectator commentary and interaction based messages.

The performance example includes three sample configurations, the following graph shows the differences based on the amount of messages parsed. The replays used are captains-mode games from the TI3 Qualifiers. The x-axis represents the amount of messages parsed, the y-access the time required in milliseconds.

Image

Memory Usage

Alice was designed to allocate a fixed amount of memory during its initialization stage in order to prevent slow reallocations and memory fragmentation. How much memory is allocated mainly depends on the combination of the following two factors:

The size of the replay only comes into play when using the dem_stream_memory. Other than that, replay size only increases the amount of memory allocated by roughly 200 kb for each 100 MB. Pre-loading the whole replay (as opposed to progressively reading it) is faster when parsing many replays concurrently.

MB
27.73^                                                                       :
     |                        ::@:::::::::@::@@:@::::@@::::::::::::::##:::::@:
     |       @::::::::::::::::: @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |       @:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |      :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |  :::::@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |  : : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |  : : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     |  : : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
     | :: : :@:: :::: : : ::: : @: :: ::: @::@ :@::: @ :: ::: ::::: :# :::::@:
   0 +----------------------------------------------------------------------->
     0

The graph above represents the amount of memory allocated during the parse of a 170 MB replay. The amount of memory allocated in the beginning increases rapidly and does only grow very little later.

Taking into account a stack-size of roughly ~6 MB, the overall memory usage will always be between 30 and 33 MB.

Building Alice on Unix

Alice utilizes CMake as its build system. To build Alice on Linux or OS X, issue the following commands in the top-level directory:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=</where/to/install/alice/> -DBUILD_ADDON=1 -DBUILD_EXAMPLE=1
make
make install

This will generate a bin folder containing the example, a lib folder containing shared and static versions of the library, as well as an include folder with the nessecary headers required to develop with Alice.

If Alice segfaults it might be usefull to turn on debugging by adding -DDEBUG=X, where X is a number between 1 and 5, to the CMake options. If debugging is enabled, Alice prints a lot of information to cout (> 300 MB). It's recommended to pipe the output in a file and only investigate the last couple of lines. This does not replace a debugger but it's helpfull in narrowing down certain kinds of errors.

Building Alice on Windows

See the accompanied build-windows.md for instructions on how to build Alice with MSVC.

Please keep in mind that, though Windows is supported, some performance optimizations are not available with MSVC and are ignored regardless of their state.

Running Alice in your Browser

Alice can be compiled using Emscripten.

See the accompanied build-emscripten.md for instructions on how to proceed.

Using Alice

The example folder contains a very basic usage example.

You can use the Devkit to get a quick overview of entities and their properties.

Image

Thanks

Thanks to edith!

Join us over in #dota2replay on QuakeNet if you have any questions.