• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:41
CEST 20:41
KST 03:41
  • 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
[ASL20] Ro8 Preview Pt2: Holding On1Maestros of the Game: Live Finals Preview (RO4)5TL.net Map Contest #21 - Finalists4Team TLMC #5: Vote to Decide Ladder Maps!0[ASL20] Ro8 Preview Pt1: Mile High15
Community News
Weekly Cups (Sept 22-28): MaxPax double, Zerg wins, PTR5BSL Season 214herO joins T121Artosis vs Ret Showmatch75Classic wins RSL Revival Season 22
StarCraft 2
General
Sharing my experience recovering lost crypto funds SC2 5.0.15 PTR Patch Notes + Sept 22nd update Weekly Cups (Sept 22-28): MaxPax double, Zerg wins, PTR Production Quality - Maestros of the Game Vs RSL 2 Maestros of the Game: Live Finals Preview (RO4)
Tourneys
LANified! 37: Groundswell, BYOC LAN, Nov 28-30 2025 Maestros of The Game—$20k event w/ live finals in Paris SC2's Safe House 2 - October 18 & 19 Master Swan Open (Global Bronze-Master 2) Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
External Content
Mutation # 493 Quick Killers Mutation # 492 Get Out More Mutation # 491 Night Drive Mutation # 490 Masters of Midnight
Brood War
General
Flash On JaeDongs ASL Struggles & Perseverance A question of legitimacy? ASL20 General Discussion ASL 20 Soundtrack Artosis vs Ret Showmatch
Tourneys
[ASL20] Ro8 Day 3 [ASL20] Ro8 Day 2 Azhi's Colosseum [ASL20] Ro8 Day 1
Strategy
Current Meta Simple Questions, Simple Answers Cliff Jump Revisited (1 in a 1000 strategy) I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Dawn of War IV Path of Exile Liquipedia App: Now Covering SC2 and Brood War!
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Canadian Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List BarCraft in Tokyo Japan for ASL Season5 Final
Blogs
[AI] Sorry, Chill, My Bad :…
Peanutsc
Try to reverse getting fired …
Garnet
[ASL20] Players bad at pi…
pullarius1
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2582 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
Kaelaris Steadfast Rott…
16:00
#12
RotterdaM1304
IndyStarCraft 330
SteadfastSC226
ZombieGrub97
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 1304
Reynor 342
IndyStarCraft 330
SteadfastSC 226
UpATreeSC 105
ZombieGrub97
MindelVK 24
StarCraft: Brood War
Britney 20518
Calm 3427
Dewaltoss 202
Zeus 148
Free 97
Barracks 88
Mini 79
Hyun 75
Rock 35
NaDa 11
[ Show more ]
Hm[arnc] 8
Dota 2
BananaSlamJamma517
monkeys_forever216
Counter-Strike
fl0m2850
byalli565
Heroes of the Storm
Liquid`Hasu365
Other Games
gofns35707
tarik_tv26182
Grubby2144
FrodaN1878
ArmadaUGS1834
ceh9712
Beastyqt623
B2W.Neo236
QueenE149
KnowMe139
ToD73
C9.Mang073
NeuroSwarm47
Trikslyr47
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 21 non-featured ]
StarCraft 2
• iHatsuTV 14
• Reevou 4
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• IndyKCrew
• intothetv
StarCraft: Brood War
• HerbMon 24
• FirePhoenix12
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3174
• masondota21660
League of Legends
• Nemesis13059
• TFBlade1085
Other Games
• imaqtpie1397
• WagamamaTV377
• Shiphtur239
Upcoming Events
OSC
5h 19m
Sparkling Tuna Cup
15h 19m
NightMare vs SHIN
ByuN vs Gerald
herO vs YoungYakov
Creator vs Nicoract
Afreeca Starleague
15h 19m
Bisu vs Larva
PiGosaur Monday
1d 5h
LiuLi Cup
1d 16h
OSC
1d 19h
Online Event
2 days
The PondCast
2 days
Online Event
3 days
Wardi Open
3 days
[ Show More ]
Online Event
3 days
Online Event
4 days
[BSL 2025] Weekly
4 days
[BSL 2025] Weekly
4 days
Safe House 2
4 days
Sparkling Tuna Cup
5 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-09-25
Maestros of the Game
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
EC S1
ESL Pro League S22
Urban Riga Open #1
FERJEE Rush 2025
Birch Cup 2025
DraculaN #2
LanDaLan #3
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

IPSL Winter 2025-26
SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
WardiTV TLMC #15
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
Frag Blocktober 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.