GetDotaStats / stat-collection

Library for setting up stat collection for dota2 mods
http://getdotastats.com/
GNU General Public License v2.0
11 stars 8 forks source link

GetDotaStats Stat-Collection

Integrating Stat Collection

Quick Start

There are three stages of integration. For a fast integration, please follow these instructions in the correct order.

Stage 1 - Before you begin

  1. Grab a copy of the library via our public repo GetDotaStats/stat-collection.
  2. Login to http://getdotastats.com, by clicking the big green button at the top of this page.
  3. Register your mod on the site by navigating to Custom Games -> Mods (My Section) -> Add a new mod, or by going straight to the registration form.
  4. Go back to your list of mods by navigating to Custom Games -> Mods (My Section), or by going straight to the My Mods page. You should now see a new entry there, that matches the mod your just registered.
  5. Take note of your modID key of 32characters. If you lose this string, refer back to this page.
  6. Make sure not to share this key, as it is unique to your mod and is used when recording stats!
    If you use Github, add a .gitignore file to the root of your project. Adding settings.kv to it will prevent from accidentally leaking your modID.
  7. An Admin will review your mod registration and approve it if it meets the submission guidelines outlined on the registration page and has a few completed games recorded. While your mod is reviewed, you can continue following this guide.

Stage 2 - Basic Integration

Now that you have the library and have completed the sign-up process, we can start the actual integration.

  1. Merge the files downloaded in (Stage 1 - Step 1). If done successfully, you will see a statcollection folder in your game/YOUR_ADDON/scripts/vscripts folder. Pay attention to the included panorama files. They should be merged into content/YOUR_ADDON/panorama folder.
  2. In your addon_game_mode.lua file, add a require statement at the top of your code that points at our library initialiser file. require("statcollection/init")
  3. Go into the scripts/vscripts/ folder and inside the settings.kv file, change the modID XXXXXXX value to the modID key you noted above (Stage 1 - Step 4). If your mod requires rounds, skip to Stage 2.5 in these instructions. If you can possibly help it, we advise modders to avoid using rounds.
  4. Check your game logic to ensure you set player win conditions nicely. This library hooks the SetGameWinner() function, so make sure to convert all of your MakeTeamLose() calls into SetGameWinner() calls. Also make sure to check every win and lose condition, as this library will only send stats at POST_GAME after a winner has been declared.
  5. Test your custom game (via workshop tools is fine), and see if stats were recorded. You can find games recently recorded against your steamID by navigating to Custom Games -> Public Profile (My Section), or by going straight to your Public Profile.
  6. You have completed the basic integration successfully if the games recorded under your mod on the RECENT GAMES page (or in your public profile) have a green phase value. If you don't see any recorded games, or they are not reaching the green phase, refer to the troubleshooting section below.
  7. Update your settings.kv by setting TESTING to false, and the "MIN_PLAYERS" to the minimum number of players you believe are required to have an interesting (playable) game. Only set TESTING to true, when troubleshooting stats in your workshop tools.

Stage 2.5 - Basic Integration for Round Based Games

Skip this section if your game is not round based. Implementing round based stats is not for the faint of heart. You will need the ability to think critically, and hopefully understand how the logic in your game works.

  1. Your mod should already have our library files merged from Stage 2 - Step 1. If not, go back and do that now.
  2. Go into the scripts/vscripts/statcollection folder and inside the settings.kv file. Set HAS_ROUNDS to true and both of the win conditions (GAME_WINNER and ANCIENT_EXPLOSION) to false.
  3. In your game logic, call statCollection:submitRound(false) at the end of every round. At the end of the final round, call statCollection:submitRound(true). Make sure to update line 108 in the schema.lua (for local current_winner_team), as we have no generic way of determining who won your arbitrary round.
  4. Double check your game logic to ensure you properly indicate which teams won each round, and that it is recorded in line 108 of schema.lua
  5. Test your custom game (via workshop tools is fine), and see if stats were recorded. You will need to play your game all the way through (up to your win or lose condition), unless you created a way to skip to the end of the game. You can find games recently recorded against your steamID by navigating to Custom Games -> Public Profile (My Section), or by going straight to your Public Profile.
  6. You have completed the basic integration (for rounds) successfully if the games recorded under your mod on the RECENT GAMES page (or in your public profile) have a green phase value. If you don't see any recorded games, or they are not reaching the green phase, refer to the troubleshooting section below.
  7. Update your settings.kv by setting TESTING to false, and the "MIN_PLAYERS" to the minimum number of players you believe are required to have an interesting (playable) game. For most games, this will be a value of 2 or 4. Only set TESTING to true, when troubleshooting stats in your workshop tools, as this setting overrides MIN_PLAYERS to 0 and prints your schema stats (Stage 3) to console.

Stage 3 - Advanced Integration OPTIONAL

Flags

Game

Players

Schema Implementation steps

  1. Create your schema after reading the above. 2 Ensure that your settings.kv has "TESTING" set to true.
  2. Clear your console log and play a single match of your custom game.
  3. Save the console log to a pastebin, hastebin, or other text hosting service.
  4. Create a new issue in our issue tracker, with the following in it:
    • Issue Title: [SCHEMA] Mod name
    • Issue Body:
    • Link to your console log
    • Link to your settings.kv (censor the modID)
    • Link to your schema.lua
    • Link to your addon_game_mode.lua and any other Lua file that defines the functions you pull stats from
  5. When an admin has accepted or looked at your schema, they will post back to that issue. There will likely be multiple iterations of your schema, as the admin will likely have suggestions for improvement.
  6. When your schema is accepted, go back to your mod list by navigating to Custom Games -> Mods (My Section), or by going straight to the My Mods page. Note your new schemaID, and update your settings.kv accordingly.

Troubleshooting FAQ

It's not working!

Implementations

Recent Games

Credits

Contact