Main Page » Stats logging for servers


Contents

Building the game with MySql Suport under Unix

Note: Windows builds come pre-compiled for mysql support so this step is not required for windows servers

Obtain a copy of the scorched3d source

Download source from the download page

Obtain a copy of the mysql development libraries

Download mysql development (libraries and header files) rpm from the download page Install the mysql development rpm.

Compile scorched3d

Compile instructions,
cd <scorched_directory> (cd into scorched directory)'
make distclean (clean settings)
sh autgen.sh --with-mysql (configure scorched, --with-mysql flag required)
make (compile)
make install (install)

Setting up the Database

MySql Database type

Download & Install

Note: Scorched3D will work just fine with an existing database install if available.

Download & install the latest MySql server package from Mysql.com

Create the stats tables

Access the database through the internal console client; then type:

create database scorched3d;
use scorched3d;
source Installation Path/data/statstables.sql

(MySql is very picky about the slash type, make sure that you use the type used in the guide)

Optional, to check if the tables were created correctly, type:

use scorched3d;
show tables;

Every table name shown should start with the scorched3d prefix.

e.g.
scorched3d_events            
scorched3d_eventtypes        
scorched3d_ipaddress         
scorched3d_names             
scorched3d_officialservers   
scorched3d_players           
scorched3d_prefixs           
scorched3d_series           
scorched3d_serverlist
...

Fix the password access (MySql >= 5.x.x)

Inside the database client console type:

set password for 'root'@'localhost' = old_password ("yourpassword");

where yourpassword is the password you are going to use

Configure the server to access the database

Set the database access

copy the file located in your Installation Path/data/mysql.xml to your User Data Directory. You must then rename this file to be mysql-port#.xml.

e.g. cp /opt/scorched3d/data/mysql.xml ~/.scorched3d/mysql-27270.xml

The port# is the one used for the players to connect to your server.

eg. The default port is 27270 so this would be mysql-27270.xml

Open the file with a text editor (for example: notepad in Windows, or vi on unix). Fill in the required information between the empty tags.

e.g. For a mysql database that you connect to as root with no password :
<mysql>
       <host>localhost</host>
       <user>root</user>
       <passwd></passwd>
       <db>s3d</db>
       <prefix>main</prefix>
       <port>/var/lib/mysql/mysql.sock</port>
</mysql>

Enable the stats logging

open the file User Data Directory/server.xml with a a text editor (for example: notepad in Windows or vi on unix).

Search for the tag called: <name>StatsLogger</name> and change the <value>none</value> to <value>mysql</value> or <value>pgsql</value>, according to your database type

Useful database commands for running servers

Once the stats are being collected there are some administration tasks that may be required. All the commands must be entered through the database client console.

Create a new stat series

use scorched3d;
update scorched3d_series set type=1 where seriesid="'#'";

The # is an incremental value, starts by default with 1, check the server logs to see what series is currently running.

Rename a stat series

update scorched3d_series set name="Series Name" where seriesid="'#'";

The # is an incremental value, starts by default with 1, check the server logs to see what series is currently running.

Donate to Scorched3D Get it from CNET Download.com! 5 Stars