• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:35
CEST 21:35
KST 04:35
  • 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
Serral wins EWC 202542Tournament Spotlight: FEL Cracow 202510Power Rank - Esports World Cup 202580RSL Season 1 - Final Week9[ASL19] Finals Recap: Standing Tall15
Community News
Weekly Cups (Jul 28-Aug 3): herO doubles up5LiuLi Cup - August 2025 Tournaments3[BSL 2025] H2 - Team Wars, Weeklies & SB Ladder10EWC 2025 - Replay Pack4Google Play ASL (Season 20) Announced58
StarCraft 2
General
Clem Interview: "PvT is a bit insane right now" Serral wins EWC 2025 TL Team Map Contest #5: Presented by Monster Energy Would you prefer the game to be balanced around top-tier pro level or average pro level? Weekly Cups (Jul 28-Aug 3): herO doubles up
Tourneys
WardiTV Mondays $5,000 WardiTV Summer Championship 2025 Sparkling Tuna Cup - Weekly Open Tournament LiuLi Cup - August 2025 Tournaments Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
External Content
Mutation # 485 Death from Below Mutation # 484 Magnetic Pull Mutation #239 Bad Weather Mutation # 483 Kill Bot Wars
Brood War
General
BW General Discussion How do the new Battle.net ranks translate? Which top zerg/toss will fail in qualifiers? Google Play ASL (Season 20) Announced Nobody gona talk about this year crazy qualifiers?
Tourneys
[ASL20] Online Qualifiers Day 2 [Megathread] Daily Proleagues Cosmonarchy Pro Showmatches [ASL20] Online Qualifiers Day 1
Strategy
Simple Questions, Simple Answers [G] Mineral Boosting Muta micro map competition Does 1 second matter in StarCraft?
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Total Annihilation Server - TAForever Beyond All Reason [MMORPG] Tree of Savior (Successor of Ragnarok)
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread Bitcoin discussion thread 9/11 Anniversary
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread Korean Music Discussion
Sports
2024 - 2025 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment" Computer Build, Upgrade & Buying Resource Thread
TL Community
TeamLiquid Team Shirt On Sale The Automated Ban List
Blogs
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
The Link Between Fitness and…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
Customize Sidebar...

Website Feedback

Closed Threads



Active: 757 users

Dota 2 Bot API 2: Training for a trainer

Blogs > LetaBot
Post a Reply
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
May 01 2016 23:39 GMT
#1
Creating a Dota 2 Bot API Part 2: Training for a trainer

Part 1: http://www.liquiddota.com/blogs/503835-dota-2-bot-api-the-glutinitial-step

After trying out the directX/OpenGL interception I found out that somehow the directX/OpenGL interception programs weren't able to grab the 3d textures from Dota 2. I got maybe one or two, but other than that there were only 2d textures showing up.
So now I have to go the reverse engineering route anyway. So I decided to drop the graphics intercepting route for now and focus first on getting to know the internals of Dota 2. If hooking into the memory and calling functions from there ( and changing the opcodes every update ) turns out to be easy (as in, not protected), then I might as well go that route.


After asking around in some forums I came across someone by the username PrayDog who already made a SDK generator. I still have to figure out why it doesn't work for me. Maybe I messed up the cmake or I don't have the right DLL injector ( if any of you got it working, pm me pls).


So in the meantime I checked to see if I could already do some basic reverse engineering. To make it simple for me (and you), I followed the tutorial from Fleep about building a trainer ( link ) and tried to apply it to Dota 2.

The idea was to create a trainer where you could play as Abaddon in Solo vs Bots single-player and have a HP cheat where your HP would always stay the same. This basically involves finding the relevant static memory address and the offsets that lead to the HP of Abadon.


This is basically what I wanted to achieve (in single player vs bots ofc):

+ Show Spoiler +
And since this video is only uploaded to my channel, I have achieved it





So how to find the memory address:

If you want to repeat these steps, make sure you start Steam in offline mode and disable your network connection completely



1. You start up cheat engine and hook it into dota2.exe
2. As your first scan, look for the current hp of Abaddon (not the maximum hp)
[image loading]

3. Receive some damage ( for example by attacking roshan)
4. Use bigger than/Smaller than to filter out the memory addresses whose value is not the same as abaddon's current hp (as shown on the dota 2 screen).

[image loading]

5. Keep on doing this until you are only left with the values that correspond with the HP of abaddon. Since the game is still running and abaddon is healing HP slowly, these values should grow as well. In the version of 1 May 2016 there should be 4 memory addresses after you are done.
6. Try to change the value of each of these memory variables. Some are only used to store the hp number that is displayed. If you change them, you will see that they will get reset the moment abaddon heals 1 hp. One of them will permanently change the hp of abaddon.


[image loading]

7. Double click on this address to add it to the address list below. Then right click the newly created row below and select "Find out what accesses this adress"

[image loading]

8. With the game still running, there will be several instructions that come up. To the left of those instructions ( first column) there will be the total amount of times that instruction has been called since the debugger was attached.
9. Basically you are looking for the instruction that has been called the same amount of time as abaddon gained hp when you started with the debugger. This basically is the instruction that heals abandon, and thus changes the HP memory address (instead of just reading it).
10. In the version of 1 May 2016 there are multiple options to chose from. Just choose any one of them. Both the offset and memory address it guesses are the same for all of them.
11. Write down the offset ( the hex value that appears after the red + sign ) and the pointer address given by cheat engine


[image loading]

12. Tick the hex box in cheat engine and start a new scan ( click new scan then click on first scan ).

[image loading]

13. This gives you all the memory addresses that hold the memory address you got in the previous step.
14. Add all the memory addresses to the list below

[image loading]

15. For each of the memory adresses, go through the same step as step 7 ( right click them, then select "Find out what accesses this adress" ). Make sure that abaddon is still damaged and thus healing himself.
16. Check to see if there is any memory address that has the same behavior as the memory address of step 9. So basically an instruction whose "count" variable is the same as the total amount of HP that abaddon has healed since the debugger has started.

[image loading]

17. Double click the instruction to get the offset ( 0 in my case)
18. Use the memory adress from 16 to perform a new scan with the hex checkbox still ticked. So don't use the one you get if you double click the instruction where you get a red text with the offset and an estimate of the pointer. You could maybe work with that as well, but it is not needed.
18. This new scan should give a green memory address. This is a static address which will never change, unlike the first memory address you found which contains the HP. If you restart Dota 2 you will see that the memory address you found at step 6 has now changed.

[image loading]

19. You can add the green memory adress to the list below and double click the address. This should give you server.dll+14E62E0 . This basically means that the memory location of this static address is based on the memory location of server.dll when it is loaded in Dota2.exe
20. Make sure that you write down the memory locations and offsets you found ( BC , 0 in my case).

[image loading]



Basically you can now use these (hex) values to edit the memory of dota 2. This will ofc only work if you are the server, because changing your HP as a client will cause a disconnect since your Dota 2 state will not be up to date with the HP value recorded on the server. However this same technique can be used to extract your own HP in an (offline) LAN game (where bots can play without bothering anyone playing online with VAC, they will only be able to play with other players willing to join their LAN lobby).

Since the goal is to make a bot API where the bot only has access to the same things a human player has, not being able to cheat is no concern to me.


With that said, you can ofc use these pointers/offsets in what is known as a trainer . For this I used a simple trainer framework created by a user called Fleep. You can find the link to the full tutorial of Fleep above. The direct link to the original framework can be found here .


That framework is based on Assault Cube. But since the HP of Abaddon is located based on the memory address of server.dll the framework needs to be extended with EnumProcessModules() to find all .dll files loaded by dota2.exe and their corresponding memory addresses. So for this I used the sample code from here and changed it such that it will only look for the memory address of server.dll , and add 0x14E62E0 to it to get the correct memory address.


You can see the source code of the hack hacked together on pastebin here .

If you want to try the hack yourself (works in single player vs bots only), you can download the .exe from below.
Just make sure that you only run it with steam in offline mode, and without your computer having any kind of internet connection whatsoever.

link to the .exe:
http://www.filedropper.com/testhack


Do note that this is only tested on the Windows 7 32 bit dota version from 1 May 2016. If Dota 2 has been updated in the meantime it might not work anymore. Any other specification difference from my PC might also cause differences in memory/opcodes.

I also used the launch options "-console -nosecure" which might make a difference ( probably not but I put it here just to be sure).

And as expected, you need to run the .exe as an admin (otherwise it won't have permission to write to the memory of dota2.exe).



All things considered you are better of recompiling it from source. I build it using Visual C++ 2012 with the option:

Character set: Use Unicode character set

IIRC that is the only option you need to change when you start with a default .exe template in Visual Studio. You can pm me if you want the full .sln


------------------------------------------------------------------------------------------------------------------------------

I found it quite interesting to know that it was possible to access this memory quite easily. And since you can be a server while playing an (offline) LAN ( offline as in, not connected to any valve service. Using hamachi or any other tunneling for LAN for online play without valve servers), it should be possible to get custom bots running on LAN servers. If it turns out that the client side is well protected, then it will be limited to bot vs human for the time being.

For now I will continue finding the offsets of the functions needed to actually perform commands in dota 2. IIRC not all of them have been found yet. If any of you know more about this do let me know. It would save me a lot of time.


p.s : yes I know that there are methods for finding the HP of every hero you can play as, not just abaddon. This blog post was just meant to show a simple example.
If you cannot win with 100 apm, win with 100 cpm.
nanaoei
Profile Blog Joined May 2010
3358 Posts
May 02 2016 17:03 GMT
#2
best of luck!
*@boesthius' FF7 nostalgia stream bomb* "we should work on a 'Final Progamer' fangame»whitera can be a protagonist---lastlie: "we save world and then defense it"
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
May 02 2016 17:48 GMT
#3
this is wayy too long to read. but best of luck!
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!
FFGenerations
Profile Blog Joined April 2011
7088 Posts
May 04 2016 19:29 GMT
#4
just to iterate, dont run any sort of 3rd party shit whilst having an internet connection because Valve will delete your steam account (afaik)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
ahswtini
Profile Blog Joined June 2008
Northern Ireland22208 Posts
May 05 2016 09:51 GMT
#5
they wont delete ur steam account lol

but u will get a game/vac ban for it
"As I've said, balance isn't about strategies or counters, it's about probability and statistics." - paralleluniverse
Please log in or register to reply.
Live Events Refresh
Next event in 4h 25m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 289
IndyStarCraft 248
BRAT_OK 148
Hui .93
StarCraft: Brood War
Sea 6836
Mini 897
EffOrt 619
Shuttle 599
firebathero 316
Soulkey 252
ggaemo 114
TY 73
Yoon 14
Stormgate
B2W.Neo819
TKL 195
JuggernautJason27
DivinesiaTV 21
Dota 2
syndereN265
capcasts10
League of Legends
Dendi1737
Reynor96
Counter-Strike
fl0m3505
pashabiceps1105
flusha232
kRYSTAL_58
Super Smash Bros
hungrybox532
Heroes of the Storm
Liquid`Hasu457
Other Games
Grubby3030
KnowMe302
Fuzer 118
Trikslyr52
QueenE46
Sick25
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 24 non-featured ]
StarCraft 2
• davetesta45
• Hinosc 26
• Reevou 5
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• IndyKCrew
• intothetv
StarCraft: Brood War
• HerbMon 25
• Azhi_Dahaki23
• blackmanpl 14
• FirePhoenix6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3373
• masondota21778
• WagamamaTV410
League of Legends
• Nemesis4676
• TFBlade1324
Other Games
• imaqtpie1667
• Shiphtur310
Upcoming Events
PiGosaur Monday
4h 25m
WardiTV Summer Champion…
15h 25m
Stormgate Nexus
18h 25m
uThermal 2v2 Circuit
20h 25m
The PondCast
1d 14h
WardiTV Summer Champion…
1d 15h
Replay Cast
2 days
LiuLi Cup
2 days
uThermal 2v2 Circuit
2 days
RSL Revival
3 days
[ Show More ]
RSL Revival
3 days
uThermal 2v2 Circuit
3 days
CSO Cup
3 days
Sparkling Tuna Cup
4 days
uThermal 2v2 Circuit
4 days
Wardi Open
5 days
RotterdaM Event
5 days
RSL Revival
6 days
Liquipedia Results

Completed

ASL Season 20: Qualifier #2
FEL Cracow 2025
CC Div. A S7

Ongoing

Copa Latinoamericana 4
Jiahua Invitational
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
HCC Europe
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025

Upcoming

ASL Season 20
CSLPRO Chat StarLAN 3
BSL Season 21
BSL 21 Team A
RSL Revival: Season 2
Maestros of the Game
SEL Season 2 Championship
WardiTV Summer 2025
uThermal 2v2 Main Event
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
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 © 2025 TLnet. All Rights Reserved.