• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:22
CEST 03:22
KST 10:22
  • 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 #21: Voting3[ASL20] Ro4 Preview: Descent7Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 6-12): Four star herO65.0.15 Patch Balance Hotfix (2025-10-8)71Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition325.0.15 Balance Patch Notes (Live version)119
StarCraft 2
General
Ladder Impersonation (only maybe) 5.0.15 Patch Balance Hotfix (2025-10-8) The New Patch Killed Mech! TL.net Map Contest #21: Voting Weekly Cups (Oct 6-12): Four star herO
Tourneys
Master Swan Open (Global Bronze-Master 2) Tenacious Turtle Tussle WardiTV Mondays SC2's Safe House 2 - October 18 & 19 Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
BW General Discussion [ASL20] Ro4 Preview: Descent BSL Season 21 BW caster Sayle ASL20 General Discussion
Tourneys
[ASL20] Semifinal B [ASL20] Semifinal A [Megathread] Daily Proleagues [ASL20] Ro8 Day 4
Strategy
Current Meta BW - ajfirecracker Strategy & Training Siegecraft - a new perspective TvZ Theorycraft - Improving on State of the Art
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Inbreeding: Why Do We Do It…
Peanutsc
From Tilt to Ragequit:The Ps…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2121 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
PiGosaur Monday
00:00
#53
PiGStarcraft552
SteadfastSC132
davetesta33
rockletztv 23
EnkiAlexander 17
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft552
WinterStarcraft391
SteadfastSC 132
RuFF_SC2 92
CosmosSc2 77
Nathanias 72
Vindicta 23
StarCraft: Brood War
Larva 707
Artosis 662
NaDa 23
League of Legends
JimRising 446
Counter-Strike
fl0m1653
Other Games
summit1g8019
Day[9].tv605
C9.Mang0394
Skadoodle259
Maynarde141
ViBE125
fpsfer 4
Organizations
Other Games
gamesdonequick1031
BasetradeTV31
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH66
• Hupsaiya 56
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV610
League of Legends
• Stunt266
Other Games
• Scarra1215
• Day9tv605
Upcoming Events
OSC
21h 39m
The PondCast
1d 8h
OSC
1d 10h
Wardi Open
2 days
CranKy Ducklings
3 days
Safe House 2
3 days
Sparkling Tuna Cup
4 days
Safe House 2
4 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 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.