Here's all the code you need to get started with making a bot for MechMania in C++. Just do these steps:
- Pre-Setup -- install Java, Node, and the
mm
command line tools - Setup -- Clone this repository and start running your bot!
-
Follow the Pre-setup instructions on the wiki here
-
Install or update clang++ to compile your C++ code! You can check out this guide on getting started with clang
-
Clone this repo (or fork it or download it somewhere as a ZIP)
-
Modify the script at
strategy.cpp
.- Write your code in the
Strategy::doTurn
method. - You may also add other files or dependencies. If you have any questions about this, we're here to help!
- Write your code in the
-
Run
make server
. This step should be completed whenever you want to run anymm
commands with a new strategy.- If you encounter any linker errors that seem to do nothing with your files, this may be a result of some dependency errors.
- Crow is the library used for the webserver, and has caused issues in the past. In particular, the boost C++ library.
- If you are still having issues, consult Boost Installation
- If you encounter any linker errors that seem to do nothing with your files, this may be a result of some dependency errors.
-
Run
mm play .
- This will build the bot in the given directory (
.
) and then starts a game in which your bot fights against itself. - On Windows, if an
mm play
command fails, make sure to close any Java SE Runtime Binary processes with Task Manager. - run
mm play
with the--logfile [filename]
option set from within Bash Subsystem for Windows to get a log for a game- then run
mm play
with the--input [filename]
option set from the Windows command prompt to view the game - This also means you can't run
mm play human
from bash subsystem
- then run
- This will build the bot in the given directory (
-
To run two different bots against each other, run
mm play bot1_directory bot2_directory
. -
To submit your bot, run
mm push .
Use mm help
for more information!
The header file (strategy.h
) has a list of functions that you should implement, and a list of functions to get data from the game are in api.h
.
Note: you should not need to edit the files inside of Resources
.
Good luck, and happy coding!
brew install boost
apt-get install libboost-all-dev