• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:46
CEST 23:46
KST 06:46
  • 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
BGE Stara Zagora 2025: Info & Preview26Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates7GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
The SCII GOAT: A statistical Evaluation BGE Stara Zagora 2025: Info & Preview Magnus Carlsen and Fabi review Clem's chess game. Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th
Tourneys
Bellum Gens Elite: Stara Zagora 2025 Master Swan Open (Global Bronze-Master 2) $5,100+ SEL Season 2 Championship (SC: Evo) SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN!
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void
Brood War
General
Will foreigners ever be able to challenge Koreans? BGH auto balance -> http://bghmmr.eu/ BW General Discussion I made an ASL quiz [BSL20] ProLeague: Bracket Stage & Dates
Tourneys
[ASL19] Grand Finals [Megathread] Daily Proleagues [BSL20] ProLeague Bracket Stage - Day 2 [BSL20] ProLeague Bracket Stage - Day 1
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
What do you want from future RTS games? Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread Mechabellum
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
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 Russo-Ukrainian War Thread Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Cognitive styles x game perf…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9015 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
BSL: ProLeague
18:00
Bracket Stage: Day 1
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
ZZZero.O340
Liquipedia
CSO Contender
17:00
#42
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ROOTCatZ 156
BRAT_OK 121
StarCraft: Brood War
Britney 18534
ZZZero.O 340
Dewaltoss 131
soO 44
Terrorterran 14
Dota 2
Pyrionflax166
League of Legends
Grubby2734
Dendi1602
Counter-Strike
fl0m7687
rGuardiaN134
Stewie2K85
Super Smash Bros
C9.Mang05353
Chillindude35
Heroes of the Storm
Liquid`Hasu582
Khaldor195
Other Games
tarik_tv18654
summit1g6992
FrodaN2432
B2W.Neo753
KnowMe45
Organizations
Dota 2
PGL Dota 2 - Secondary Stream4134
Other Games
gamesdonequick727
BasetradeTV106
StarCraft 2
angryscii 40
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• Hupsaiya 73
• musti20045 28
• Adnapsc2 27
• RyuSc2 19
• tFFMrPink 6
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21392
• Ler145
League of Legends
• Doublelift2225
Counter-Strike
• Shiphtur258
Other Games
• imaqtpie1477
Upcoming Events
Replay Cast
2h 14m
SOOP Global
5h 14m
Creator vs Rogue
Cure vs Classic
SOOP
11h 14m
Classic vs GuMiho
Sparkling Tuna Cup
12h 14m
AllThingsProtoss
13h 14m
Fire Grow Cup
17h 14m
BSL: ProLeague
20h 14m
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
1d 2h
Replay Cast
2 days
Replay Cast
2 days
[ Show More ]
WardiTV Invitational
2 days
WardiTV Invitational
2 days
GSL Code S
3 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
4 days
GSL Code S
4 days
herO vs TBD
Classic vs TBD
The PondCast
4 days
Replay Cast
5 days
GSL Code S
5 days
WardiTV Invitational
5 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
WardiTV Invitational
6 days
Cheesadelphia
6 days
Cheesadelphia
6 days
Liquipedia Results

Completed

CSL Season 17: Qualifier 1
DreamHack Dallas 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.