• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 20:33
CET 02:33
KST 10:33
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
BGE Stara Zagora 2026 announced8[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge2
StarCraft 2
General
BGE Stara Zagora 2026 announced SC: Evo Complete - Ranked Ladder OPEN ALPHA When will we find out if there are more tournament Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge
Tourneys
RSL Revival: Season 3 Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death
Brood War
General
Which season is the best in ASL? A cwal.gg Extension - Easily keep track of anyone BW General Discussion soO on: FanTaSy's Potential Return to StarCraft BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Nintendo Switch Thread The Perfect Game Stormgate/Frost Giant Megathread Beyond All Reason Should offensive tower rushing be viable in RTS games?
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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Artificial Intelligence Thread YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2485 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
Replay Cast
23:00
2025 KFC Monthly #3 - Day 2
Liquipedia
The PiG Daily
20:15
Best Games of SC
Clem vs Solar
Solar vs herO
herO vs ByuN
Reynor vs Nicoract
Clem vs herO
Solar vs MaxPax
PiGStarcraft548
LiquipediaDiscussion
LAN Event
18:00
LANified! 37: Groundswell
Discussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft548
CosmosSc2 50
PiLiPiLi 20
StarCraft: Brood War
Calm 4204
NaDa 40
ivOry 9
Dota 2
syndereN341
monkeys_forever309
League of Legends
JimRising 0
Counter-Strike
PGG 70
minikerr36
Super Smash Bros
hungrybox490
Other Games
summit1g11684
tarik_tv4609
C9.Mang0218
ViBE62
PPMD20
Organizations
Other Games
gamesdonequick717
StarCraft 2
CranKy Ducklings122
Dota 2
PGL Dota 2 - Main Stream120
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• Berry_CruncH95
• Hupsaiya 88
• HeavenSC 33
• davetesta31
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• Azhi_Dahaki48
• RayReign 24
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21296
League of Legends
• Doublelift5119
• HappyZerGling115
Other Games
• Scarra1378
Upcoming Events
Replay Cast
7h 27m
WardiTV Korean Royale
10h 27m
OSC
15h 27m
Sparkling Tuna Cup
1d 8h
WardiTV Korean Royale
1d 10h
Replay Cast
1d 22h
Wardi Open
2 days
Monday Night Weeklies
2 days
StarCraft2.fi
2 days
Replay Cast
2 days
[ Show More ]
Wardi Open
3 days
StarCraft2.fi
3 days
PiGosaur Monday
3 days
Wardi Open
4 days
StarCraft2.fi
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
5 days
Liquipedia Results

Completed

SOOP Univ League 2025
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 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.