• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 06:26
CET 12:26
KST 20:26
  • 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
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Data analysis on 70 million replays Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET 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
Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Nintendo Switch Thread 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
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Big Programming Thread Artificial Intelligence 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
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
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1211 users

Creating a Dota 2 Bot API Part 3: float on

Blogs > LetaBot
Post a Reply
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
May 12 2016 02:30 GMT
#1
Creating a Dota 2 Bot API Part 3: float on

Part 2: http://www.liquiddota.com/blogs/508438-dota-2-bot-api-2-training-for-a-trainer


Next up in the variables needed for a Bot API is the position of units/camera.

If you know anything about the internal workings of RTS games you know that most things in the game are stored as units. In StarCraft Brood War the buildings are stored with the unit class for example. So are most of the spells you can cast.

Dota 2 works in the same way, but it uses the name entities to describe the objects in the game. The position of an entity is in the same class as a unit, so it is just a matter of finding the offset for it, just like xorentor did for his Dota2harvester ( https://github.com/xorentor/dota2harvester/blob/master/src/client_win32cli/d2h.c#L551 ).
Here is how to find the new offset:

If you want to try it yourself, keep in mind that you should start steam in offline mode and turn of your internet

1. After you made sure that steam is in offline mode and you have no internet, you start Dota 2 with the launch option: -console

2. You start of by finding the HP of an entity. I choose my own hero since I can move him around freely, but technically any entity that moves could be used ( so don't use runes :p )

Look at part 2 of my blog to see how to get the HP value.

[image loading]


3. Now press ctrl+T to start a new scan (or click on file->Add scan tab).
4. Search for a float with an unknown initial value

[image loading]

5. Move to the left ( this decreases the x position )
6. Do a next scan with "Decreased value" selected.

[image loading]

7. Move to the right
8. Do a next scan with "Increased value" selected.

[image loading]

9. After doing this for a while you will narrow the addresses down.
10. open the console with \ , then make sure your cursor is on your hero and type in:
sv_cheats 1
ent_text

11. Look for the addresses that have the same x value as is given in the debug output.
12. Select the ones whose memory address is close the the memory address of your HP.

13. To be sure which one is correct, calculate the difference in memory address between your HP and x possibilities. For example 33C69120 - 33C68C5C = 4C4 .

14. Find the HP memory address of one of the creeps. Add the value from 13 to it, and set the type to a float.
15. Check the resulting value with the ent_text for that creep.
16. Choose the offset difference that gives you the correct result

[image loading]

Getting the camera position

17. Open the console and type in "cl_showpos 1"
18. Search for a float with an unknown initial value
19. Repeat step 5-9 but with your camera instead of your hero
20. Select several of the memory addresses and them to the addresslist below
21. Shift select them then press the space-bar to activate all of them
22. Move your camera around and see if you are forces back to your original location
23. Narrow this down to one address


[image loading]

24. Find out what accesses this memory address
25. Move the camera around and look at the counter of the opcodes that access the address.
26. Select the one you see in the image below and record the offset (22C in this case) and the memory address (0B980C80 in this case)

[image loading]

27. Search for the address you got at 26 in a new scan. This should give you two green memory addresses.
28. Pick any one of them. Now combined with your offset you can not only read the camera x position but also write (change) it.

[image loading]



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


So the only things left now to make a very simple but already functional bot API is:
- Add a method to access and iterate over all the entities (and figure out their type/team)
- Translate the position of the entities and the camera into x,y coordinates on the screen


Sending commands to Dota 2 via calling in-game functions (DLL injection) is a bit to much of a hassle for me now. So I will stick with sending commands via simulated input for now.
If you cannot win with 100 apm, win with 100 cpm.
Jaeger
Profile Joined December 2009
United States1150 Posts
May 12 2016 05:44 GMT
#2
Man that is an awesome write up, thanks for the blog.
https://www.dotabuff.com/players/8137911
Ler
Profile Blog Joined August 2012
Germany543 Posts
May 12 2016 08:02 GMT
#3
People that write RE related stuff are awesome! You Sir are awesome!
Twitter: @Ler_GG | Facebook: lergg | youtube: lerlolgg | Twitch.tv/gg_nore | #ArtOfSupport
Please log in or register to reply.
Live Events Refresh
Next event in 34m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 217
ProTech121
MindelVK 46
StarCraft: Brood War
Calm 4555
Horang2 1808
Shuttle 1777
Jaedong 630
actioN 607
Mini 280
Hyun 278
Light 208
Last 173
EffOrt 160
[ Show more ]
ZerO 133
Rush 124
Pusan 119
Snow 104
Zeus 76
Sharp 74
ToSsGirL 57
Killer 53
hero 47
sorry 40
Mong 34
NotJumperer 27
soO 20
scan(afreeca) 15
ajuk12(nOOB) 12
Hm[arnc] 6
Terrorterran 3
Dota 2
singsing467
XaKoH 453
League of Legends
JimRising 311
Reynor50
Counter-Strike
olofmeister1922
shoxiejesuss751
x6flipin266
allub140
Other Games
B2W.Neo509
Fuzer 198
KnowMe84
ZerO(Twitch)7
Organizations
Other Games
gamesdonequick614
StarCraft: Brood War
lovetv 6
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH145
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota266
League of Legends
• Jankos2328
• Stunt871
Upcoming Events
Wardi Open
34m
StarCraft2.fi
5h 34m
Replay Cast
12h 34m
The PondCast
22h 34m
OSC
1d 4h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 12h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
3 days
SC Evo League
3 days
[ Show More ]
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
WardiTV 2025
4 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
5 days
StarCraft2.fi
5 days
Replay Cast
5 days
WardiTV 2025
6 days
StarCraft2.fi
6 days
PiGosaur Monday
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

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
Acropolis #4 - TS3
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
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.