# Gathering Stats from a StarCraft 2 game

One of the maps I've played, nicknamed SotiS (DoTA in SC2) has the ability to maintain stats, which are sent back to their own server.

Does anybody know how this is done?

SC2 maps do not have the ability to connect to databases or web services - this could easily be abused. SoTiS can do it using a separate application, but most maps do not use this.

The only persistent storage SC2 maps have are the bank files, XML files saved with the extension .SC2Bank in your SC2 data folder. All player stats, settings, etc. from that map are stored in that map's bank file.

The maps usually do not actually keep track of global records - rather, they keep track locally of the best records seen so far. Every time a game is started, everyone's individual leaderboards are combined and overwritten with the combined leaderboard. This causes the leaderboard records to spread very quickly, much like a computer virus.

For example, if my top-3-players list consists of having seen player A with score 300, player B with 200, and C with 100; and you've seen player D with 400, A with 350 (he improved his score!) and E with 50; then when we play with each other, both of our high-score lists will be overwritten with player D with 400, A with 350, and B with 200. There are a few more kinks to work through (ex. usernames are not unique, so you also need to propagate some sort of unique ID), but otherwise this solution works well.

Of course, since the high-scores are stored locally, it will always be possible for someone to hack the scores. The only reason stats-hacking is not more widespread than it currently is is that the bank signature algorithm has not been reverse-engineered
The bank signing algorithm has now been released to the public by hackers, and, as expected, high score lists on all maps are now completely meaningless.

I believe you can write to files with the scripting available in SC2. The server interaction is done by a separate application.

• There newest version doesn't require that, yet it says it is recording the stats of all players. Unless I read that wrong... – Austen Apr 30 '11 at 5:44
• It might be possible that only one player needs to run the program and it will update for all players in the current game session. Other than that, I am pretty sure there is no way to make connections to servers using scripting in SC2. I didn't see it says all players are tracked on that page. Does it say that somewhere else? – Chewy Gumball Apr 30 '11 at 6:35
• They may well be just storing that data in the data file they can create for each player. – DeadMG May 1 '11 at 11:04
• Indeed, but it would just be sitting on their computer without being transmitted to the stats tracking server. – Chewy Gumball May 1 '11 at 16:20