Skip to content

Workflow for Debugging Bots

Keithen edited this page Mar 15, 2017 · 15 revisions

Up Front Setup (Enable console and console logging):

This will allow a hotkey (default '') to activate the console and will log all console output to a special file in the dota 2 directory

  • Go to Steam Library
  • Right click Dota 2
  • Select properties
  • On the General Tab, select Set Launch Options.
  • Add the text inside the quotes to the options: "-console -condebug"
  • Create this folder (note: this assume default install location for Dota 2): C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\scripts\vscripts\bots
  • Place your bot code in a special folder "Dota Game install Dir"\game\scripts\vscripts\bots (e.g C:\SteamLibrary\steamapps\common\dota 2 beta\game\dota\scripts\vscripts\bots)
    • Cd into "Dota Game install Dir"\game\scripts\vscripts
    • Clone directly into bots directory from the vscripts directory. git clone git@github.com:Nostrademous/Dota2-FullOverwrite.git bots

Setting up a bot game to test your bots

  • Start a lobby
  • Set server location to Local Host
  • Make it private (give it a name and a password and set lobby visibility to unlisted)
  • Allow cheats by clicking the box
  • Under Advanced Lobby Settings
    • Change Radiant and Dire Difficulty to Unfair
    • Select Fill Empty Slots with Bots
    • Select your bots "Local dev script" under Radiant or Dire bots and Select whatever the other bots are that you want to use.
  • Unassign yourself from a team
  • Start the game

In Game Testing Quality of Life Adjustments

  • With Console Open ('')
    • enable cheats by typing 'sv_cheats 1'
    • use 'host_timescale x.y' to speed up or slow down gameplay so you don't have to watch it all at normal speed
    • for other cheats in console see: Console Cheat Commands

Code modules for debugging

  • The "debugging.lua" module simplifies the usage of the API's DebugDraw* functions, by saving the debug data and calling the needed API functions every frame.
    • SetBotState(bot, line, text): writes text in line (1<=line<=2) of the bot's status field. bot must be a handle.
    • SetTeamState(category, line, text): writes text in line (1<=line<=6) of the category's status field. category can be any string.
    • SetCircle(name, center, r, g, b, radius): draws a filled circle at the center vector and size radius. Color will be rgb(r,g,b). The name is used for updating/deleting.
    • DeleteCircle(name): deletes the circle with the given name
Clone this wiki locally