• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:31
CEST 02:31
KST 09:31
  • 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] Ro24 Preview Pt2: Take-Off6[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax5Maestros of The Game—$20k event w/ live finals in Paris30Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
Weekly Cups (Aug 18-24): herO dethrones MaxPax What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : A Eulogy for the Six Pool Geoff 'iNcontroL' Robinson has passed away 2v2 & SC: Evo Complete: Weekend Double Feature
Tourneys
WardiTV Mondays Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
No Rain in ASL20? BW General Discussion Flash On His 2010 "God" Form, Mind Games, vs JD BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ro24 Preview Pt2: Take-Off
Tourneys
[ASL20] Ro24 Group E [Megathread] Daily Proleagues [ASL20] Ro24 Group D [ASL20] Ro24 Group B
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5971 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
PiGosaur Monday
00:00
#46
PiGStarcraft236
SteadfastSC38
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft236
NeuroSwarm 147
Nina 136
ProTech85
CosmosSc2 43
Nathanias 41
SteadfastSC 38
StarCraft: Brood War
Artosis 781
Hyuk 470
NaDa 54
Sharp 36
Dota 2
monkeys_forever368
Counter-Strike
fl0m1044
taco 101
Super Smash Bros
hungrybox316
AZ_Axe83
PPMD44
Liquid`Ken8
Other Games
summit1g7182
shahzam1616
Day[9].tv847
C9.Mang0352
WinterStarcraft245
ViBE244
Maynarde150
ToD130
Organizations
Other Games
gamesdonequick833
BasetradeTV16
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• RyuSc2 43
• rockletztv 11
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota22476
League of Legends
• Stunt236
Other Games
• Day9tv847
Upcoming Events
Afreeca Starleague
9h 29m
hero vs Alone
Royal vs Barracks
Replay Cast
23h 29m
The PondCast
1d 9h
WardiTV Summer Champion…
1d 10h
Clem vs Classic
herO vs MaxPax
Replay Cast
1d 23h
LiuLi Cup
2 days
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
2 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
2 days
Team Hawk vs Team Dewalt
BSL Team Wars
2 days
Team Hawk vs Team Bonyth
SC Evo League
3 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
[ Show More ]
Maestros of the Game
3 days
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[BSL 2025] Weekly
3 days
SC Evo League
4 days
Maestros of the Game
4 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
4 days
Team Bonyth vs Team Sziky
BSL Team Wars
4 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
5 days
Replay Cast
5 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

CSLAN 3
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSL Season 18: Qualifier 2
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
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.