• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 12:31
CET 18:31
KST 02: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
RSL Revival - 2025 Season Finals Preview7RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly 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 win3
StarCraft 2
General
RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle 2025 RSL Offline Finals Dates + Ticket Sales! Sparkling Tuna Cup - Weekly Open Tournament StarCraft2.fi 15th Anniversary Cup
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle Let's talk about Metropolis
Tourneys
[ASL20] Grand Finals [BSL21] RO8 - Day 2 - Sunday 21:00 CET [BSL21] RO8 - Day 1 - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Fighting Spirit mining rates Current Meta
Other Games
General Games
Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread Awesome Games Done Quick 2026! Nintendo Switch Thread
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 Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1678 users

Dota 2 Bot API #6: apache/php framework POC

Blogs > LetaBot
Post a Reply
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
Last Edited: 2016-08-05 16:41:30
August 05 2016 00:54 GMT
#1
Dota 2 Bot API #6: apache/php framework proof of concept

Hello everyone,


As you all might know, the built-in Dota 2 bots are easy to defeat. As written in my previous blog posts, the LUA scripting engine has some limitations which prevent it from being used to create a top level bot. So instead I decided to create my own Dota 2 bot API framework such that programmers can write bots for Dota 2, and your average Joe Dota 2 player can easily install these bots and play against them.

Tobias Mahlmann already created a beginning for a Dota 2 bot API framework (see also my blog #5).
But as mentioned on the github page, the framework isn't finished. Tobias Mahlmann also mentioned the following on how to run the example bot: "you need to be familiar with Java programming and building an application using maven".


So I decided to create a different approach which won't require any programming knowledge. For this I use an apache/php server. The added benefit to this is that it is easier to program a Bot in many different programming languages as opposed to a TomCat server which is mainly for the Java programming language.


Anyway, in this blog entry I will show you how to install and run the proof of concept that I have created. This POC is intentionally kept simple, so don't expect much from the bots. This is mainly to demonstrate the install and run process. When actual bots are made with this framework, the install process won't change much.


The end result should looks something like this, but less laggy (unless your PC is somehow even worse than mine )




There are quite some steps involved, but they are all straightforward.


1. Install XAMPP. This tool will install apache and php for you, so you won't have to spend some time configuring it. Make sure that you don't install it to "Program files" because on most windows computers apache won't have write permission there.


2. Start up XAMPP.

[image loading]


3. Start an Apache server

[image loading]

[image loading]

4. Go to your browser and type in the adress bar "localhost/" and press enter. This should bring you to "http://localhost/dashboard/" if your apache started correctly.

[image loading]


5. Download the necessary files from:
https://github.com/MartinRooijackers/Dota2AIframeworkProofOfConcept

There is an option to download everything as a zip, so you won't have to install any git software.
Download the zip and unpack it.

[image loading]

6. Go to the htdocs folder of the zip you unpacked and select/copy the "test.php" file

[image loading]

7. paste this file into the htdocs folder of your XAMPPS folder. In my case that would be "C:\xampp\htdocs\test.php"

Don't worry about the Dota2AI.exe , that is optional for now and only for those who want to test the C++ and php inter-process communication.

[image loading]

8. In your browser go to:

http://localhost/test.php?hpvalue=500

If your apache is running, it should only display the word "ATTACK"

[image loading]

9. Now go to

http://localhost/test.php?hpvalue=300

If your apache is running, it should only display the word "RETREAT"

[image loading]


10. Now install the dota 2 mod itself. There are two ways of getting it to run.

The first option is to copy the dota2aiframe folder to your dota_addons folder. But this is only useful when you have the dota 2 workshop tools installed. In case you do, you probably already know how to run a dota 2 mod.

Instead we are going to use the mod I put on the workshop.

Go to the following link:

http://steamcommunity.com/sharedfiles/filedetails/?id=737176343

click on the green subscribe button to install the mod

[image loading]

11.
Make sure that your apache server is running ( repeat steps 8 and 9 to be sure )

Also make sure that in the launch options of Dota 2, the console is enabled ( add "-console" to the launch options )

Now start up dota 2, go to the arcade, and look for "Dota2AIframeworktest" in the library

[image loading]


12. Click on it. Then click on "create custom lobby" (the blue button).

In the map option, select "Dota"

[image loading]

set a password for the lobby (to allow cheats ) and then enabled cheats ( to allow the host to add bots )

[image loading]

You can play with up to 5 people. Just remember to all go radiant, because for now all heroes on the Dire side are considered bots (if you join Dire as a human player then the LUA code will start controlling your hero).


13.

Open up the console with the \ key

You should see a lot of "test1".
If not, then the mod is not running properly

[image loading]

When you are in the console, type the following two commands:

sv_cheats 1
dota_bot_populate


(optional) to ensure that the command worked, you can type the vision cheat in chat:
-allvision


Once the Dire bots are spawned they should attack move towards the Radiant fountain, and retreat when their HP falls below 400 hp (it is checked once per second, so there might be a slight delay).


14. In case you don't have vision around the T1 and T2 tower, ping around them. This will ofc not be an issue in the final product.

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

With this setup you could use the apache/php to use File I/O for machine learning and technically even multi-threading (two things that are disabled in the Dota 2 LUA). But the main reason for this type of framework is that you can use just about any programming language to program your bot.

For those who want to try it out, you can put the Dota2AI.exe in the htdocs folder and run it. Then open the test.php and change the line

$usePHPonly = true;

into

$usePHPonly = false;

Make sure that Dota2AI.exe is running and go through steps 11-14 again. If done correctly, you should have the same functionality in the sense that the bots retreat at 400 hp, but now the decision is made inside C++ code.



Anyway this is just a proof of concept to show how the apache/php architecture allows for many different programming languages to be used in order to create a Dota 2 Bot. As you might be able to see from the steps 1-14, there is no programming or compiling needed to run this framework.
If you cannot win with 100 apm, win with 100 cpm.
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
August 05 2016 00:57 GMT
#2
I am considering crowdfunding to add the missing features from Tobias Mahlmann's LUA code and allow that code to connect to an apache server with the above framework instead of a Tomcat server. The php code would ofc also have to be created.

A draft of this crowdfunding page can be found at:

https://www.indiegogo.com/project/preview/f607f206#/


I am open for suggestions for perks and other feature you might want to see in a Dota 2 Bot API.
If you cannot win with 100 apm, win with 100 cpm.
TheVideoGameGuy
Profile Joined May 2015
India211 Posts
August 05 2016 15:51 GMT
#3
Cool stuff!
Thy dendemic fools completing thy generic life processes
Piledriver
Profile Blog Joined August 2010
United States1697 Posts
Last Edited: 2016-08-05 18:32:01
August 05 2016 18:08 GMT
#4
Is there a reason why you are running a web based application and the poor performance and latencies that accompany it? Isn't it always better to run a locally compiled C++ or windows based application that has far better performance?

Edit: Just saw that the LUA allows only http requests. But I still think you should be able to write some kind of app that is able to intercept http requests and send back appropriate responses without having to locally host a xampp server and all the overhead of a client-server architecture. Something like Node.js maybe a better solution.
Envy fan since NTH.
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
Last Edited: 2016-08-05 18:38:59
August 05 2016 18:33 GMT
#5
On August 06 2016 03:08 Piledriver wrote:
Is there a reason why you are running a web based application and the poor performance and latencies that accompany it? Isn't it always better to run a locally compiled C++ or windows based application that has far better performance?

Edit: Just saw that the LUA allows only http requests. But I still think you should be able to write some kind of app that is able to intercept http requests and send back appropriate responses without having to locally host a xampp server. It may be crucial for the bots to make split second decisions in real time.



Well, this is just a proof of concept of course. Since XAMPP automatically installs and enables php and other CGI interfaces, it is the easiest method for the average user to install.

With an apache webserver you can ofc use the CGI to run C++ directly, as well as just about any other programming language.


When bots are complex enough in their decision making, it would indeed be a good idea to reduce overhead (to reduce latency), but for now I deliberately decided to keep things simple to setup.
If you cannot win with 100 apm, win with 100 cpm.
Please log in or register to reply.
Live Events Refresh
Next event in 2h 29m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 88
BRAT_OK 78
MindelVK 52
JuggernautJason51
Railgan 32
StarCraft: Brood War
Britney 24492
Calm 2776
Jaedong 672
Horang2 498
Hyuk 346
EffOrt 205
Mini 200
Last 151
Hyun 95
Zeus 76
[ Show more ]
scan(afreeca) 50
Mong 36
Aegong 34
ggaemo 33
Noble 8
Dota 2
Gorgc6091
singsing3733
qojqva2320
Counter-Strike
fl0m15346
byalli488
chrisJcsgo32
Heroes of the Storm
Khaldor578
Liquid`Hasu416
Other Games
B2W.Neo773
Beastyqt763
ToD159
XaKoH 89
ArmadaUGS74
Mew2King24
OptimusSC21
Organizations
Other Games
WardiTV1512
StarCraft 2
ComeBackTV 994
angryscii 18
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• HeavenSC 23
• Adnapsc2 8
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis2615
Other Games
• Shiphtur547
Upcoming Events
IPSL
2h 29m
Sziky vs JDConan
BSL 21
2h 29m
Tech vs Cross
Bonyth vs eOnzErG
Replay Cast
15h 29m
Wardi Open
18h 29m
Monday Night Weeklies
23h 29m
Sparkling Tuna Cup
1d 16h
Replay Cast
3 days
The PondCast
3 days
CranKy Ducklings
5 days
SC Evo League
5 days
[ Show More ]
BSL 21
6 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
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

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
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.