Compiling BerryBots on Linux
If you already have the dependencies installed, you can just use configure and make straight away.
~> unzip berrybots_src_1.3.3.zip ~> cd berrybots ~/berrybots> ./configure ~/berrybots> make ~/berrybots> sudo make install
After installing, you should be able to run berrybots from anywhere and you should see a BerryBots icon in your Applications menu.
With apt-get:sudo apt-get install libsfml-dev libwxgtk3.0-dev libarchive-devWith dnf:sudo dnf install SFML-devel wxGTK3-devel libarchive-devel
Otherwise, you need to download them for your platform or compile them from source.
BerryBots uses SFML 2 for the main game graphics. If SFML 2 is installed, configure will detect it and use it. Otherwise, you need to pass the path to SFML using --with-sfml-src (compiled from source) or --with-sfml-dl (downloaded libs).
You can install SFML on Debian/Ubuntu by installing the libsfml-dev package, or on Fedora with the SFML-devel package. You can also download binaries from sfml-dev.org or compile it from source.
Note: As of this writing, SFML in the Fedora repo is at 2.3.1, which has some issue causing hangs in BerryBots. This is fixed in 2.3.2, so you should compile that version from source instead (or an older version like 2.1 or 2.2).
Note that SFML has their own instructions for building SFML 2 with CMake, which may be helpful.
Before compiling, you need to install some build tools (like C++ and CMake) and a few other libraries.
On Ubuntu:sudo apt-get install build-essential cmake sudo apt-get install libgl1-mesa-dev libxrandr-dev libfreetype6-dev \ libglew1.5-dev libjpeg8-dev libopenal-dev libsndfile1-dev \ libxcb-image0-dev libudev-dev libjpeg8-dev
On Debian, you need libjpeg62-turbo-dev instead of libjpeg8-dev:sudo apt-get install build-essential cmake sudo apt-get install libgl1-mesa-dev libxrandr-dev libfreetype6-dev \ libglew1.5-dev libjpeg8-dev libopenal-dev libsndfile1-dev \ libxcb-image0-dev libudev-dev libjpeg62-turbo-dev
On distros that use dnf, like Fedora:sudo dnf install gcc gcc-c++ cmake sudo dnf install mesa-libGL-devel libXrandr-devel freetype-devel \ glew-devel libjpeg-turbo-devel openal-soft-devel libsndfile-devel \ xcb-util-image-devel systemd-devel flac-devel libvorbis-devel
Next, grab the source from the SFML downloads page or the GitHub repo and extract it. Open a terminal and change into the SFML source directory. Use CMake to generate the build files that are used for actual compilation, then use make to compile SFML.
~> cd ~/SFML-2.3.2 ~/SFML-2.3.2> mkdir build ~/SFML-2.3.2> cd build ~/SFML-2.3.2/build> cmake .. ~/SFML-2.3.2/build> make
When it completes, you should have a lib subdirectory with the SFML library files. For a user named "voidious", this would translate to: --with-sfml-src=/home/voidious/SFML-2.3.2
BerryBots uses wxWidgets 3.0 for everything besides the main game window: all the dialogs and menus for configuring battles, packaging ships and stages, and viewing output consoles. If wxWidgets 3.0 is installed, configure will detect it and use it. Otherwise, you need to pass the path to wxWidgets using --with-wxdir or --with-wx-config.
You can install wxWidgets on Debian/Ubuntu by installing the libwxgtk3.0-dev package, or on Fedora with the wx-GTK3-devel package. You can also download binaries from wxWidgets.org or compile it from source. There are also unofficial packages in the wxWidgets 3.0 repos from CodeLite.
Note: As of this writing, wxWidgets 3.0.2 from the Fedora repo installs wx-config-3.0 instead of wx-config, and thus is not detected. You can pass --with-wx-config=/usr/bin/wx-config-3.0 to configure.
wxWidgets has their own instructions for compiling wxWidgets on Linux, which may be helpful.
Before compiling, you need to install some build tools (like a C++ compiler) and GTK development files.
With apt-get:sudo apt-get install build-essential libgtk2.0-dev
With dnf:sudo dnf install gcc gcc-c++ cmake gtk2-devel
Download wxWidgets 3.0 source code from the wxWidgets downloads page and extract it. Open a terminal and navigate to the wxWidgets directory. Then compile wxWidgets with configure and make.
~> cd ~/wxWidgets-3.0.2 ~/wxWidgets-3.0.2> ./configure --disable-shared ~/wxWidgets-3.0.2> make
The --disable-shared parameter means that wxWidgets libraries will be built for static linking. So you don't need to keep the wxWidgets libraries around - the required wxWidgets code is baked right into the executable.
This will take a few minutes to compile. When it completes, you should have a lib subdirectory with the wxWidgets library files. For a user named "voidious", this would translate to: --with-wxdir=/home/voidious/wxWidgets-3.0.2
BerryBots uses libarchive for packaging ships and stages as tarred / gzipped (.tar.gz) files. The gzip compression itself is handled by zlib, which should be included with most Linux distros. If libarchive is installed, configure will detect it and use it. Otherwise, you need to pass the path to libarchive using --with-libarchive.
Libarchive is widely available, so you can probably just install libarchive and its development files from your repo as libarchive-dev or libarchive-devel.
Download libarchive from libarchive.org. Extract it, open a terminal, and change into the libarchive directory. Then compile libarchive with configure and make.
~> cd ~/libarchive-3.1.2 ~/libarchive-3.1.2> ./configure ~/libarchive-3.1.2> make
When it completes, you should have .libs/libarchive.a under the build directory. (Note that .libs is a hidden directory.) For a user named "voidious", this would translate to: --with-libarchive=/home/voidious/libarchive-3.1.2
Compiling everything from source
If you're building everything from source, the whole process would look something like this:
~> unzip ~/Downloads/SFML-2.3.2-sources.zip ~> cd SFML-2.3.2 ~/SFML-2.3.2> mkdir build ~/SFML-2.3.2> cd build ~/SFML-2.3.2/build> cmake .. ~/SFML-2.3.2/build> make ~/SFML-2.3.2/build> cd ~ ~> tar xfv ~/Downloads/wxWidgets-3.0.2.tar.bz2 ~> cd wxWidgets-3.0.2 ~/wxWidgets-3.0.2> ./configure --disable-shared ~/wxWidgets-3.0.2> make ~/wxWidgets-3.0.2> cd ~ ~> tar xfv ~/Downloads/libarchive-3.1.2.tar.gz ~> cd libarchive-3.1.2.tar.gz ~/libarchive-3.1.2> ./configure ~/libarchive-3.1.2> make ~/libarchive-3.1.2> cd ~ ~> unzip ~/Downloads/berrybots_src_1.3.3.zip ~> cd berrybots ~/berrybots> ./configure --with-sfml-src=/home/voidious/SFML-2.3.2 \ --with-wxdir=/home/voidious/wxWidgets-3.0.2 \ --with-libarchive=/home/voidious/libarchive-3.1.2 ~/berrybots> make ~/berrybots> sudo make install
The BerryBots source package also contains a version of BerryBots that launches individual matches from the command line. This is how things worked on Mac and Linux in v1.0.x, and how things still work on the Raspberry Pi.
You may find this useful, such as for running matches from other programs or running BerryBots from the command line on a remote system - you could use -nodisplay -savereplay and then view the replay in a browser. The code for this is in bbsfmlmain.cpp.
To compile this version of BerryBots on Linux, run make linuxcli. Then run matches or package ships or stages with berrybots.
./berrybots Usage: berrybots [-nodisplay] [-savereplay] <stage.lua> <bot1.lua> [<bot2.lua> ...] OR berrybots -packstage <stage.lua> <version> OR berrybots -packbot <bot.lua> <version>