Version 2 (modified by milosh, 8 years ago) (diff)

Added shell file link.

Running TWCore on Unix

Prior warning: I must admit that the bots that come with TWCore aren't the best to be applied to any zone, most of them are quite specific for Trench Wars. However, the TWCore Core is a good basis for hosting and creating new bots on.

This guide describes and helps you to setup TWCore to run in your zone.
If you want to develop bots for TWCore, see the Programming guide.

The following steps are described:

  1. Prerequisites
  2. Downloading TWCore
  3. Building TWCore
  4. Configuration
  5. Ready to run

Problems while following this guide? Ask your question at the forum!


There are some things you need to have for running TWCore:

  1. If you are on a Linux distribution, download and install the appropriate Java Development Kit (JDK)

If you are OS X then the JDK comes preinstalled and can likely be found at /System/Library/Java/JavaVirtualMachines

  1. Ant (Download Current Release of Ant, .zip archive)

This may already be installed for your distribution. Try ant -version to check.

  1. Subversion (SVN)

This also may already be installed for your distribution. Try svn --version to check.

  1. (Access to) a Subspace zone


  1. (Access to) a MySQL database

Setting $JAVA_HOME
Once you have your JDK downloaded and extracted you need to point your $JAVA_HOME towards it.

  1. Open up the file that declares your systems PATH variable. This will differ depending on your distribution but it might be /etc/bashrc, /etc/profile, ~/.bashrc or ~/.profile. It will look something like:

export PATH=/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$PATH

  1. Add a line above the export PATH line and type export JAVA_HOME='/path/to/jdk'
  2. The correct directory should contain a folder called bin with the java executable in it. Path to this executable would look like /path/to/jdk/bin/java, but don't include the /bin/java on the end when declaring JAVA_HOME.
  3. Save and close the file with the export JAVA_HOME in it. Now type source nameOfFile where nameOfFile is the file you just edited.
  4. You can check to make sure you properly declared your JAVA_HOME with echo $JAVA_HOME, which should return /path/to/jdk.

Downloading TWCore

In this step you will export the most recent TWCore version from the repository of .

  1. Navigate to the directory where you want the TWCore project to exist. (i.e. cd ~)
  2. Type svn checkout -username <username> TWCore where <username> is your username.
  3. When it prompts you for a password use your password.

You can always update TWCore safely as it doesn't affect any running / binary files nor your configuration files.

Building TWCore

Before you can use and configure TWCore, it needs to be built.

  1. Navigate to TWCore/trunk/twcore, where you should see a file called build.xml.
  2. Type ant -v with no additional parameters. This will build the project.

Note for building TWCore, TWCore must be turned off completely! Your configuration files will not be touched during the build process.


Go into the TWCore/trunk/twcore/bin folder and configure the configuration files:

  1. Rename setup.example.cfg to setup.cfg
  2. Open setup.cfg and fill in the settings:
    • [Server]
      • Server
        should be set to the IP of the Subspace server you are connecting to
      • Port
        should be set to the port of the Subspace server you are connecting to
    • [Login Information]
      • Main Login
        the name of the Continuum account for the TWCore Hubbot.
      • Main Password
        the password of the Continuum account for the TWCore Hubbot.
      • Sysop Password
        the sysop password for the zone you are connecting to.
    • [Chat Names]
      • Chat Name
        the default chat name of any bots that require it. Usually this is used to set to a chat used by the TWCore developers.
      • Staff Chat
        the chat name of the staff chat.
      • Smod Chat
        the chat of the smod/upper staff chat.
    • [Debugging]
      • DebugOutput
        Set DebugOutput to 0 to turn stack traces off, 1 to turn them on. Stack traces are useful for debugging bots.
    • [Directories]
      • Core Location
        Set this to the exact location where this setup.cfg is located. Do not end this with a slash. For example: C:\Subspace\TWCore (Windows) or /home/bots/twcore (Linux).
    • [Logging]
      • Exception Log
        Set the file and path of the exception log. This log will contain any exceptions the bot runs into. For example: C:\Subspace\TWCore\exception.log or /home/bots/twcore/exception.log
      • LogPrivateMessages
        Set LogPrivateMessages to 1 to have each bot record private messages in the /logs folder.
  1. Rename all the files in the corecfg directory to .cfg. For example: autoload.cfg and sql.cfg. Small description of each configuration file:
    • autoload.cfg
      All the bots in this file will be automatically spawned when TWCore is started and connected to the Subspace server.
    • operators.cfg
      This file provides startup permissions for specified users and defines how the bot auto-assigns privileges.
    • racism.cfg
      This file is a list of fragments that will be flagged by racism detection.
    • sql.cfg
      This file contains the settings for working with a database. If you do not (want to) use a database, set ConnectionCount to 0. For more information, see below.
  1. [Optional] Configure sql.cfg:
    • [General]
      • RetryCount
        Amount of retries a connection is tried before it will be given up
      • ConnectionCount
        Number of connections defined in this file and/or number of connections that are used.
    • [Connection X] (Replace X for a number starting with 1, also with settings below)
      • NameX
        Name of the connection. This same name is also used by the bots. The connection names used by the bots that come with TWCore are local, website and server.
      • DriverX
        Name of the sql driver. This is usually set to com.mysql.jdbc.Driver which you don't need to change unless you want to work with a different type database then MySQL.
      • LoginX
        The username used for connecting to the database server.
      • PasswordX
        The password used for connecting to the database server.
      • DataBaseX
        The database name that should be used. Make sure this database already exist on the server.
      • ServerX
        The IP or the address of the database server. If the database is on the same machine, set it to localhost. If the database is not on this machine, make sure you have the database server configured that it allows external connections.
      • PortX
        The port used to communicating with the database server. If you are using a MySQL server then you can leave it set to 3306.
      • MinPoolSizeX
        The minimum number of connections required to be in the pool. You can leave the default set to 1.
      • MaxPoolSizeX
        The maximum number of connections of the connection pool. You can leave the default set to 10.
      • WaitIfBusyX
        Wait if the connection is busy. Can be set to 0 or 1.

        You can create several connections in this file, you only need to change the X in each setting to the respective connection number.

Ready to run

If you have configured everything then you should be all set!

  1. Download to the TWCore/trunk/twcore directory
  2. The first line of the file should be #!/bin/bash
  3. The second line of the file should be while true; do java -Xmx386m -cp bin/twcore.jar:libs/googleapi.jar:libs/aim.jar:libs/mysql-connector-java-5.0.7-bin.jar twcore.core.Start bin/setup.cfg; done
  4. The bot with the name you configured in setup.cfg will now enter your zone. This is the HubBot, it can spawn other bots on your command.

Spawning bots

In TWCore we have two names for a specific bot; the bot type and the bot name.
The bot type is the name of the directory. The main .java and .cfg file within this directory both have the same name as the bot type. You use this bot type to specify which bot to spawn. The bot name is the name you configure inside the .cfg file.

To spawn a bot follow the following steps:

  1. The first time you spawn a bot you have to rename its .example.cfg file to .cfg.
    For example, multibot.example.cfg to multibot.cfg.
  2. Open the .cfg file (with notepad for example) and set the correct values. This usually consists of configuring the name, password and initial arena.
  3. Start up TWCore if you haven't already
  4. PM !spawn <bottype> to your HubBot.
  5. If the bot doesn't spawn into your zone, check the TWCore console for error messages.

Problems while following this guide? Ask your question at the forum!

Attachments (1)

Download all attachments as: .zip