• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:29
CET 12:29
KST 20:29
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy7ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289
Community News
Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool43Weekly Cups (March 9-15): herO, Clem, ByuN win42026 KungFu Cup Announcement6BGE Stara Zagora 2026 cancelled12
StarCraft 2
General
Tips +1(415) 794-0262 How to Take Payments on PayP Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (March 16-22): herO doubles, Cure surprises Weekly Cups (August 25-31): Clem's Last Straw? Team Liquid Map Contest #22 - Presented by Monster Energy
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament World University TeamLeague (500$+) | Signups Open RSL Season 4 announced for March-April WardiTV Team League Season 10 KSL Week 87
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat Mutation # 516 Specter of Death
Brood War
General
ASL21 General Discussion Soulkey's decision to leave C9 BGH Auto Balance -> http://bghmmr.eu/ JaeDong's form before ASL [ASL21] Ro24 Preview Pt1: New Chaos
Tourneys
[ASL21] Ro24 Group B [ASL21] Ro24 Group A ASL Season 21 LIVESTREAM with English Commentary [Megathread] Daily Proleagues
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books Movie Discussion! [Manga] One Piece
Sports
2024 - 2026 Football Thread Cricket [SPORT] Formula 1 Discussion Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2538 users

Dota 2 Bot API: The (glut)Initial step

Blogs > LetaBot
Post a Reply
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
February 09 2016 21:20 GMT
#1
Creating a Dota 2 Bot API Part 1: The (glut)Initial step
I decided to take a small break from creating my StarCraft bot (Wiki)LetaBot to see how well bots perform in other e-sport titles. While checking the subreddit, I found out that Dota 2 has an offline LAN mode. This got me interested in checking if it was possible to create a bot API for Dota 2 like the one that Matthew Fisher did for StarCraft 2 ( https://graphics.stanford.edu/~mdfisher/GameAIs.html ). The advantages for using this method over the build-in scripting language is that a build-in scripting language is significantly slower than C++ code, and you cannot store/retrieve as much information as your hard drive can handle ( haven't used Dota 2 script, so correct me if I am wrong about Dota 2 script limitations).

The problem with using DirectX interception to create a bot for StarCraft 2 is that you have to use battle.net to play against other players, and Blizzard won't like it if you use DirectX interception on battle.net . After all, DirectX interception allows you to do stuff like this:

[image loading]

Or even more outlandish stuff like this.

But with an offline LAN mode, you don't have to worry about this sort of stuff getting you banned and leaving you with no other options to play versus other players.

The first attempt to get the graphics interceptor was to use the Matthew Fisher's DirectX interceptor on Dota 2, since the interception part of the code doesn't care about the program it is used on ( placing the modified d3d9.dll in the dota2.exe folder makes it load that one instead of the one in system32 ). This doesn't seem to work since dota 2 crashes when it tries to start up the main menu ( probably something involving the shaders that dota 2 uses, as you will see in apitrace below. ). It did manage to store the load screen textures:

[image loading]

So when I contacted Matthew Fisher, he directed me to a different program called apitrace. That one does manage to collect all the directX API calls, but for some reason it has problems with the shaders as well, causing the frame replay to look mostly black ( with only the top/bottom GUI, healthbars and some flame effects visible). So instead I switched to OpenGL. One driver update later I was capable of getting apitrace to record and replay the OpenGL calls.


Some pictures of the success below:


[image loading]

This is the texture of (Wiki)tiny IIRC.

[image loading]

Scene rendering in progress. Notice the checkerboard textures below each hero (and the spells), and the fact that this image is flipped ( vertically, the original image was upside down ).



Since apitrace is open source, this can be use as an initial starting point to use the same technique that Matthew Fisher used to make his StarCraft 2 bot.
Very ( very very ) simply put, the following needs to be added to the apitrace to make it usable for a Dota 2 Bot API:

- Know which texture belongs to which hero. You can look at Matthew Fisher's texture table for StarCraft 2 to see an example of this.

- Know when these textures are drawn, and where on the screen the texture/hero is located ( as in, not on the XY coordinates of the dota 2 map, but the XY coordinates of your monitor ).

- Use the information above to determine when/where to click on the screen. You are basically sending click commands instead of using a physical mouse, just like AutoIt and other related programs do. The difference is that you aren't relying on the color of certain pixels like a simple runescape bot, but on the information that is send through the graphics pipeline (getting this information purely based on the pixels on the screen is too complex for a game like Dota 2: it would take too much time to process and dota 2 is too fast paced for that).


Besides hero location you ofc also need things like the location of creeps, your/ally/enemy health and all that sort of stuff.


Anyway, I am going back to my StarCraft bot now. I still have to wrap up my master thesis on it. If anyone is interested in already starting on developing such an API, you can pm me and I can give you some (OpenGL, graphic pipeline) guides that can help you get started. In general you will need to know about C++ and OpenGL ( general 3d graphics knowledge should suffice as well, it is mainly about extracting information, not programming OpenGL ). I myself will start digging more into this stuff next month (March).
If you cannot win with 100 apm, win with 100 cpm.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
February 09 2016 22:38 GMT
#2
Are you not able to just memory scan for on-screen hero locations and minimap hero locations? Surely this would be far easier than graphics hooks.
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
Sn0_Man
Profile Blog Joined October 2012
Tebellong44238 Posts
February 09 2016 22:41 GMT
#3
Interesting

Just out of curiosity, are you aware that valve wrote some of their own bots?

Which of course are quite different since they don't seek to simulate human interaction with the client in any way of course, but still something worth thinking about.
LiquidDota StaffSCIENTISTS BAFFLED | 3275929302
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
Last Edited: 2016-02-09 23:19:33
February 09 2016 23:18 GMT
#4
On February 10 2016 07:38 Birdie wrote:
Are you not able to just memory scan for on-screen hero locations and minimap hero locations? Surely this would be far easier than graphics hooks.


That is what the BWAPI does for StarCraft Brood War. However, one update could change all the relevant opcodes, which means that you have to redo the process. Whereas the textures tend to stay the same for each hero after an update. And even if it changes it is just a matter of finding the right texture again instead of having to go trough the entire program looking for the memory adress.

On February 10 2016 07:41 Sn0_Man wrote:
Interesting

Just out of curiosity, are you aware that valve wrote some of their own bots?

Which of course are quite different since they don't seek to simulate human interaction with the client in any way of course, but still something worth thinking about.


Yes, I know about the build-in bots. But those are very easy to defeat. I don't recall them releasing an API to control these bots directly.
If you cannot win with 100 apm, win with 100 cpm.
Ler
Profile Blog Joined August 2012
Germany543 Posts
February 10 2016 08:13 GMT
#5
I am also kinda in bot programming and I was kinda impressed when I read about the Sc2 bot Matthews released. If you continue your work, write about it please
Twitter: @Ler_GG | Facebook: lergg | youtube: lerlolgg | Twitch.tv/gg_nore | #ArtOfSupport
misirlou
Profile Joined June 2010
Portugal3277 Posts
February 10 2016 12:31 GMT
#6
Is it not possible to code bots on dota 2 tools for custom maps?
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
February 10 2016 12:46 GMT
#7
well lemme know once you finished writing an api wrapper

is there a way to canonicalize hero appearance? I imagine it'll be much easier if all the hero appeared the same and not altered by the costumes they wear.
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
February 10 2016 13:46 GMT
#8
On February 10 2016 21:31 misirlou wrote:
Is it not possible to code bots on dota 2 tools for custom maps?



It is. But as I mentioned, the scripting language is a lot slower compared to native C++ code. Also you can store/retrieve more data between matches using file I/O . I don't even know if file input/output is possible with the scripting language.

Since dota 2 is quite complex, I don't think that simple scripts are going to be enough to create bots that can defeat top level human players.
If you cannot win with 100 apm, win with 100 cpm.
spamduck101
Profile Joined August 2015
United States8 Posts
February 10 2016 16:19 GMT
#9
Very cool! Keep us posted. I didn't know about Matt's SC2 stuff. That was a fun read.
misirlou
Profile Joined June 2010
Portugal3277 Posts
February 10 2016 20:27 GMT
#10
On February 10 2016 22:46 LetaBot wrote:
Show nested quote +
On February 10 2016 21:31 misirlou wrote:
Is it not possible to code bots on dota 2 tools for custom maps?



It is. But as I mentioned, the scripting language is a lot slower compared to native C++ code. Also you can store/retrieve more data between matches using file I/O . I don't even know if file input/output is possible with the scripting language.

Since dota 2 is quite complex, I don't think that simple scripts are going to be enough to create bots that can defeat top level human players.

I didn't think that was what you meant by "built in scripting language" but it makes sense now. Yeah I guess the scripts are limited that way and I don't see valve adding file I/O support for it since you could basically start distributing a bunch of crap that would harm a system via the workshop.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
February 11 2016 13:47 GMT
#11
On February 10 2016 22:46 LetaBot wrote:
Show nested quote +
On February 10 2016 21:31 misirlou wrote:
Is it not possible to code bots on dota 2 tools for custom maps?



It is. But as I mentioned, the scripting language is a lot slower compared to native C++ code. Also you can store/retrieve more data between matches using file I/O . I don't even know if file input/output is possible with the scripting language.

Since dota 2 is quite complex, I don't think that simple scripts are going to be enough to create bots that can defeat top level human players.


do we know if the scripting language is turing complete or is it actually very primitive like that of starcraft map editor?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Torte de Lini
Profile Blog Joined September 2010
Germany38463 Posts
January 06 2017 21:45 GMT
#12
Bumping this. Is Letabot still around?
https://twitter.com/#!/TorteDeLini (@TorteDeLini)
Please log in or register to reply.
Live Events Refresh
Afreeca Starleague
10:00
Ro24 Group B
Soulkey vs Ample
JyJ vs sSak
Afreeca ASL 10368
StarCastTV_EN271
Liquipedia
Sparkling Tuna Cup
10:00
Weekly #124
Percival vs YoungYakovLIVE!
CranKy Ducklings150
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 204
SortOf 137
ProTech122
Lowko15
StarCraft: Brood War
Britney 21724
Calm 15673
Flash 7116
Bisu 5250
GuemChi 1585
BeSt 954
firebathero 662
EffOrt 445
Light 374
Stork 338
[ Show more ]
ZerO 327
Pusan 326
Zeus 297
actioN 270
Leta 221
Snow 168
HiyA 118
Rush 112
Mind 94
ToSsGirL 83
PianO 71
Sharp 70
Killer 66
Barracks 43
Nal_rA 38
Sea.KH 25
GoRush 21
Bale 20
Terrorterran 18
Hm[arnc] 17
Shinee 16
yabsab 14
Dewaltoss 13
Noble 12
Icarus 11
sorry 8
soO 8
Purpose 7
Movie 5
IntoTheRainbow 4
Dota 2
BananaSlamJamma255
canceldota153
League of Legends
JimRising 300
Counter-Strike
olofmeister2166
shoxiejesuss862
x6flipin363
zeus349
Other Games
singsing2210
B2W.Neo506
XBOCT398
Sick245
crisheroes216
Happy175
Livibee60
Trikslyr19
Organizations
StarCraft: Brood War
UltimateBattle 308
Dota 2
PGL Dota 2 - Main Stream106
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 51
• CranKy Ducklings SOOP6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 4
• iopq 4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Upcoming Events
Replay Cast
21h 31m
Afreeca Starleague
22h 31m
hero vs YSC
Larva vs Shine
Kung Fu Cup
23h 31m
Replay Cast
1d 12h
KCM Race Survival
1d 21h
The PondCast
1d 22h
WardiTV Team League
2 days
Replay Cast
2 days
WardiTV Team League
3 days
RSL Revival
3 days
Cure vs Zoun
herO vs Rogue
[ Show More ]
WardiTV Team League
4 days
Platinum Heroes Events
4 days
BSL
4 days
RSL Revival
4 days
ByuN vs Maru
MaxPax vs TriGGeR
WardiTV Team League
5 days
BSL
5 days
Replay Cast
5 days
Afreeca Starleague
5 days
Light vs Calm
Royal vs Mind
Wardi Open
5 days
Monday Night Weeklies
6 days
Sparkling Tuna Cup
6 days
Afreeca Starleague
6 days
Rush vs PianO
Flash vs Speed
Liquipedia Results

Completed

Proleague 2026-03-23
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
BSL Season 22
CSL Elite League 2026
CSL Season 20: Qualifier 1
ASL Season 21
Acropolis #4 - TS6
RSL Revival: Season 4
Nations Cup 2026
NationLESS Cup
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

2026 Changsha Offline CUP
CSL Season 20: Qualifier 2
CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.