Shoddy Battle

Setting up a server

If you have a high uptime, or if you would just like to experiment, you may find it useful to run a server. Please read all of the information on this page in order to ensure a seamless installation.

Important: if your server appears to be working (i.e. you can connect to it using your public IP in the Advanced connect window), then you should post in this topic to ask that it be listed permanently.

*NEW*A more complete guide to building a server from source is available here.

  1. Upgrading
  2. Download
  3. Installation
  4. Configuration
  5. MySQL Database
  6. Launching

§ Upgrading

On most operating systems, to upgrade you will just need to stop the server and then install the new version. However, on Windows, you must completely uninstall (run the uninstaller jar in the Shoddy Battle Server directory) the old version before you may upgrade or it will not work.

§ Download

First, download the appropriate package for the installer. This table allows you to decide which file to download. Note that the generic package will work even on systems where a more specific package exists.

Your System Package
Microsoft Windows shoddybattle-1.7-windows.exe
GNU/Linux on x86 shoddybattle-1.7-gnu-linux-x86
Anything else shoddybattle-1.7-generic.jar

The source code of Shoddy Battle can be found in the shoddybattle-1.7-source.zip package. If you want the most up to date sources (and for most practical purposes, you probably do), check the code out from the cvs repository or view it online.

§ Installation

In all operating systems, make sure you run the installer as an administrator (also known as a "root" user).

On Windows, just run the installer. (Use Right Click -> "Run as Admin" on Windows Vista.)

On GNU/Linux x86, open a terminal and enter the following. You will be prompted for your root (administrator) password.

su -c /path/to/the/file/shoddybattle-1.7-gnu-linux-x86

If your GNU/Linux distribution does not enable the root account then you may instead use

sudo /path/to/the/file/shoddybattle-1.7-gnu-linux-x86

To use the generic package, open a command terminal and enter the following. You will be prompted for your root (administrator) password.

su -c 'java -jar "/path/to/the/jar/shoddybattle-1.7-generic.jar"'

You will have to replace the part in double quotes by the actual path to the jar. As before, if your operating system does not enable the administrator account, try instead

sudo java -jar "/path/to/the/jar.jar"

During the installation, you will be prompted for a universally unique identifier (UUID). You can use the following UUID:

72fccaa6c07a45142c5e7e95fadf56a0

§ Configuration

All of the settings for the server are stored in the server.properties file, which can be found in the directory where you installed the program. On Windows, make sure you edit this file with WordPad rather than Notepad. This file is only read when the server is started, so if you make a change to it, you must restart the server (see below).

Mod files from NetBattle can be upgraded to work with Shoddy Battle. Abilities will not necessarily convert correctly because NetBattle's Trait syntax used arbitrary slot numbers. However, they will be correct in the majority of cases. To perform the upgrade, we suggest you save your NetBattle mod file in the Shoddy Battle Server directory as something like mod.txt. On Windows, open up a command prompt and enter

cd "C:\Program Files\Shoddy Battle Server"
upgrademod.bat dpspecies.db mod.txt mod.patch

On other operating systems, instead use

cd "/usr/bin/Shoddy Battle Server"
./upgrademod dpspecies.db mod.txt mod.patch

(In both cases change the path to where you installed the server.) This will save the Shoddy Battle database patch file as mod.patch. Now open up server.properties in your favourite text editor and change

# Patch file to apply against the metagame.
server.patch = 

to

server.patch = mod.patch

Restart the server if it was previously running.

§ MySQL Database

Only server operators familiar with MySQL should attempt this.

In the server.properties file it is possible to set a MySQL database to use for the users database rather than a file. Using a MySQL database has numerous advantages. For example, it may be faster for large servers, and it allows you to execute arbitrary queries without having to use the Shoddy Battle client GUI.

After setting the options in the server.properties file, you will need to create a users table in the database you specified. You will need to use a sequence of commands similar to this one at the MySQL console:

connect the_specified_database;
CREATE TABLE users (id int(11) PRIMARY KEY NOT NULL auto_increment, name text, password text, ip text, level int(11) NOT NULL, unban bigint(20) NOT NULL);

You will want to create an account for the server's first administrator. You could do this from the MySQL console but it a bit tricky because the passwords are hashed. Instead, at the terminal, change into the server's directory and execute:

java -cp dist/ShoddyBattle.jar shoddybattle.AccountEditor AdminUserName adminpassword 2

where '2' is the user level (0 is a regular user; 1 is a mod; 2 is an admin). If you specifiy the name of a user who already exists, the level will be changed, but not the password.

This tool also works for the file-based user account storage but it is less useful there since the installer will create your first admin account.

§ Launching

Output from the server will appear in the wrapper.log file in the installation directory.

In Windows, to start or stop the server, open the Services control panel, which is generally found in an "Admin Tools" directory in the Control Panel, and enable (or disable) the Shoddy Battle Server.

In other operating systems, open a command line terminal and try

shoddybattle start

to start the server, or

shoddybattle stop

to stop it. Other possible parameters include status, which prints whether the server is running, and restart, which restarts the server.

If your server appears to be working (i.e. you can connect to it using your public IP in the Advanced connect window), then you should post in this topic to ask that it be listed permanently.