• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:35
CEST 19:35
KST 02: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
TL.net Map Contest #22 - Voting & Ladder Map Selection3Code S Season 2 (2026) - RO8 Preview5[ASL21] Finals Preview: Two Legacies21Code S Season 2 (2026) - RO12 Preview2herO wins GSL Code S Season 1 (2026)7
Community News
[BSL22] Non-Korean Championship from 13 to 28 June0Weekly Cups (May 25-31): Clem doubles, 2v2 circuit heads toward finale0StarCraft II 5.0.16 PTR Patch Notes may 26th151Weekly Cups (May 18-24): MaxPax wins doubles0Crank Gathers Season 4: BW vs SC2 Team League6
StarCraft 2
General
My starcraft 2 changes StarCraft II 5.0.16 PTR Patch Notes may 26th The Death of Cheese: From a Professional Cheeser TL.net Map Contest #22 - Voting & Ladder Map Selection Oliveira Would Have Returned If EWC Continued
Tourneys
Maestros of The Game 2 announcement and schedule ! Crank Gathers Season 4: BW vs SC2 Team League GSL Code S Season 2 (2026) Sparkling Tuna Cup - Weekly Open Tournament RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
[G] Having the right mentality to improve
Custom Maps
[D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 528 Infection Detected Welcome to the External Content forum Mutation # 527 Hell Train
Brood War
General
14k games analyzed: Cross Spawn Nexus first good? Tesagi Viewer - A new era of replay watching FlaSh's ASL S21 Finals Review BGH Auto Balance -> http://bghmmr.eu/ VPN experiences
Tourneys
[ASL21] Grand Finals [BSL22] Grand Finals - Sunday 21:00 CEST [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2
Strategy
Why doesn't anyone use restoration? Any training maps people recommend? Muta micro map competition [G] Hydra ZvZ: An Introduction
Other Games
General Games
Stormgate/Frost Giant Megathread Warcraft III: The Frozen Throne Path of Exile Nintendo Switch Thread ZeroSpace Megathread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread How cold is too cold to be outdoors? Dating: How's your luck?
Fan Clubs
The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread McBoner: A hockey love story TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Esportsmanship: How to NOT B…
TrAiDoS
Why RTS gamers make better f…
gosubay
ramps on octagon
StaticNine
ASL S21 English Commentary…
namkraft
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4476 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
Maestros of the Game
15:30
Group D
Clem vs Lambo
Zoun vs SKillous
ComeBackTV 1651
IntoTheiNu 1206
RotterdaM962
TaKeTV 511
Rex97
BRAT_OK 91
EnkiAlexander 86
3DClanTV 76
LiquipediaDiscussion
uThermal 2v2 Circuit
15:00
Season Finals: Group Stage 1
Serral1757
uThermal1116
mouzHeroMarine293
IndyStarCraft 161
SteadfastSC125
Classic71
LamboSC267
SKillous37
trigger31
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Serral 1757
uThermal 1116
RotterdaM 962
mouzHeroMarine 293
IndyStarCraft 161
SteadfastSC 125
Rex 97
ProTech93
BRAT_OK 91
Classic 71
LamboSC2 67
UpATreeSC 56
SKillous 37
JuggernautJason33
trigger 31
MindelVK 22
RushiSC 21
StarCraft: Brood War
Britney 33205
Calm 6901
EffOrt 820
Shuttle 622
ggaemo 341
firebathero 226
Mong 93
Dewaltoss 62
HiyA 28
Rock 23
[ Show more ]
Sacsri 19
NaDa 17
GoRush 14
Dota 2
Gorgc6974
qojqva1218
Counter-Strike
fl0m7226
byalli941
zeus338
Heroes of the Storm
Khaldor168
Other Games
Grubby3232
FrodaN1907
B2W.Neo824
Beastyqt478
C9.Mang0168
Hui .151
crisheroes146
KnowMe140
Mew2King48
QueenE47
OptimusSC26
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• HerbMon 17
• FirePhoenix4
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota249
League of Legends
• TFBlade971
Other Games
• imaqtpie510
• Shiphtur248
Upcoming Events
Replay Cast
6h 25m
Replay Cast
15h 25m
Solar vs Classic
uThermal 2v2 Circuit
21h 25m
Grudge Match
22h 25m
FlaShFTW vs A.Alm
OSC
1d 3h
MaxPax vs YoungYakov
Krystianer vs Shameless
GgMaChine vs Creature
LetaleX vs MiniZergUA
ReBellioN vs TBD
ArT vs HiGhDrA
Nicoract vs Azura
GSL
1d 14h
herO vs Rogue
Maru vs Cure
Patches Events
1d 19h
uThermal 2v2 Circuit
1d 21h
BSL
2 days
OSC
2 days
[ Show More ]
Monday Night Weeklies
2 days
Replay Cast
3 days
Sparkling Tuna Cup
3 days
Replay Cast
4 days
Kung Fu Cup
4 days
Maestros of the Game
4 days
Replay Cast
5 days
The PondCast
5 days
Replay Cast
6 days
Liquipedia Results

Completed

KK 2v2 League Season 1
RSL Revival: Season 5
Heroes Pulsing #1

Ongoing

BSL Season 22
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
CSCL: Masked Kings S4
YSL S3
SCTL 2026 Spring
WardiTV Spring 2026
Maestros of the Game 2
uThermal 2v2 2026 Main Event
2026 GSL S2
Murky Cup 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026

Upcoming

BSL 22 Non-Korean Championship
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
Heroes Pulsing #3
Heroes Pulsing #2
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
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.