• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:14
CET 01:14
KST 09:14
  • 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 (Dec 1-7): Clem doubles, Solar gets over the hump0Weekly 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
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 Weekly Cups (Nov 24-30): MaxPax, Clem, herO win
Tourneys
StarCraft2.fi 15th Anniversary Cup Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly)
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/ BW General Discussion Foreign Brood War Data analysis on 70 million replays MBCGame Torrents
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile ZeroSpace Megathread The Perfect Game
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
European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread The Big Programming 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? The Automated Ban List
Blogs
I decided to write a webnov…
DjKniteX
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1456 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 11h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft386
elazer 291
SteadfastSC 173
JuggernautJason74
CosmosSc2 47
PattyMac 2
StarCraft: Brood War
Artosis 786
Shuttle 602
NaDa 22
Dota 2
syndereN1019
Super Smash Bros
PPMD123
Heroes of the Storm
Grubby3784
Other Games
shahzam441
ToD181
XaKoH 136
Maynarde123
Livibee47
ZombieGrub41
C9.Mang025
Organizations
Other Games
gamesdonequick472
BasetradeTV104
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Hupsaiya 86
• RyuSc2 28
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• FirePhoenix29
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie1899
• Shiphtur123
Upcoming Events
WardiTV 2025
11h 47m
StarCraft2.fi
15h 47m
PiGosaur Monday
1d
StarCraft2.fi
1d 16h
Tenacious Turtle Tussle
1d 23h
The PondCast
2 days
WardiTV 2025
2 days
StarCraft2.fi
2 days
WardiTV 2025
3 days
StarCraft2.fi
4 days
[ Show More ]
RSL Revival
4 days
IPSL
4 days
Sziky vs JDConan
RSL Revival
5 days
Classic vs TBD
herO vs Zoun
WardiTV 2025
5 days
IPSL
5 days
Tarson vs DragOn
Wardi Open
6 days
Replay Cast
6 days
Liquipedia Results

Completed

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

Ongoing

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

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
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.