At a minimum you will need to change -proot in the script to where root is your mysql root password. If your password is 'foo' then you would use '-pfoo' instead.

You can use this script any time the repository is updated, but it will drop the table and thus delete all your player data. You may want to make manual changes instead unless you are using it purely as a test server.

Using Navicat

(flag)

This is the more hands-on approach, and being comfortable doing it this way may make it easier to update individual tables later without having to learn the mysql command-line interface.

Open Navicat

Click Connection (or File, New Connection)

Connection name: DarkStar

Host Name/IP: localhost

Port: 3306

User Name: root

Password: Enter the password you wrote down during the mySQL installation.

Check Save Password

Click OK

In the connections pane double click DarkStar

Right click on DarkStar and select New Database...

Name it dspdb

Use the Default character set

Select OK.

Double click dspdb

Right click on dspdb and select Execute SQL File...

Browse to C:\dsp\sql and select abilities.sql

Click Start

Continue this process for each file in the folder.

If you have an issue with the triggers.sql file then follow this step. If not, proceed to the next step (IP address for the map server):

In Navicat Open accounts table

Click File, Design Table

Click the Triggers tab

There should a line already listed with account_delete in the Name field

Configure the ZoneIP for the Map Server

Now you need to determine what IP address that will be used for the Map Server, then update MySQL with it.

Most devs & enthusiasts will not have a separate map server, but will run both map server and login server on the same PC.

1. Determine what IP address will be used for the map server.

If the server will be public, then use your external IP in the next step. (Looks really random 173.194.43.104)

If the server will be internal and you want it available on other PCs in your internal network, use the internal network IP (192.168.x.x) in the next step.

If you only plan to run the client and the server on the same PC, you can use the localhost address (127.0.0.1) in the next step.

2. Calculate the new form from the IP address.

The IP must be entered in different form, so first we must calculate the new form. Use the formula below or This Handy Site to calculate it. If you use the site you must put the IP in reverse order to get the required value (i.e. instead of 127.0.0.1 which gives 2130706433 put in 1.0.0.127 to get 16777343).

Add the following code into the empty space, inserting the value calculated above. The value in the code below (16777343) would be used if only running the client from the same PC as the server.

UPDATE zone_settings SET zoneip = '16777343';

Select Run. "256 queries should be successful!" should be the result.

I recommend you save the Query in case you need to run it again later after updating the server.

Close Navicat.

Building the Servers

In this section we will be building the Dark Star servers.

Dark Star uses 3 separate servers. A Login server, a Map/Game server, and an optional Search/Auction House server. Using the ZoneIP mentioned earlier, every map could run on its own server at a different IP address. If you have 4 computers each computer could run different areas, as long as they were all connected to the same MySQL database server.

Build the Login Server

Open Visual Studio

Click File, Open, Project/Solution (or Ctrl+Shift+O)

Navigate to C:\dsp\win32\DSConnect-Server

Select DSConnect-server.sln (usually the first one)

It may take a few minutes to load files.

Click Debug then Build Server (or F7, or Ctrl+Shift+B)

Building will take a few minutes.

Once complete, validate that there are no Errors listed in the summary line at the bottom. It should look like this:

At this point we have configured the servers to connect to the SQL database.

Starting the Servers

In this section we will launch our new servers.

Navigate to c:\dsp

Run DSConnect-server.exe as Admin

Run DSGame-server.exe as Admin

(Optional) Run DSSearch-server.exe as Admin

At this point if your servers fail to load, you probably missed a step. Go back through the steps and try to find out what you missed. It may also be helpful to look at the log files located in c:\dsp\log.

Forward Ports to Allow Others to Join (& Firewall)

In this section we will provide the port numbers that need to be forwarded to the server. This is only needed to allow people outside your local intranet to join your server.

In your router and firewall the following ports need to be opened/forwarded to your server:

TCP Ports:
54230
54231
54001
54002
UDP Port:
54230

If still having trouble, disable any firewall software completely for testing. This includes the Windows firewall that comes on all modern Windows systems, which can be found in the Control Panel.

Installing & Setting up the DS Server on Linux

The server is known to build in recent Debian GNU/Linux, Ubuntu, and Fedora versions, and is tested regularly against all three platforms. It is also known to build on Gentoo.

Generic build instructions for most POSIX (GNU/Linux, and possibly FreeBSD, NetBSD, UNIX or even OSX with some additional work) systems follow. Some knowledge of how to compile software on your distribution is assumed. You may find it helpful to reference the Windows guide above if something is unclear.

Prerequisites:

A compiler with C++11 support. Currently tested with GCC and G++, and requires a minimum version of 4.6

Git to retrieve the source code.

patch to apply the search server patch (should be installed with subversion if your system lacks it)

Autotools (automake autoconf m4sh) and pkg-config to generate the configure script and Makefile

mysql server

mysql client library (select the developer version if your distro has one)

lua library version 5.1 or higher (select the developer version if your distro has one)

If you plan to run from a console, you may also wish to install "screen" as there is no daemon mode for the servers yet.

Preparing the Source Code

Once you have everything mentioned above installed, grab the latest source from the repository via the command:

git clone http://github.com/DarkstarProject/darkstar.git/

Compiling

Next is a typical autotools build. Run the autogen script, followed by configure, and then make:

sh autogen.sh
./configure --enable-debug
make

You can choose not to configure with debug enabled, but there is very little potential gain in this and it prevents many useful break statements from triggering. The Makefile also has separate targets to build each server named "dsconnect" "dsgame" and "dssearch" but will build all 3 if none are specified.

Compiling on 64-bit

These steps were done on Ubuntu 12.04.
First you need to install the relevant packages:

You'll note that these are 32-bit packages which are needed to build in 32-bit mode.
If you already have the 64-bit mysql client libraries already installed, you have to uninstall them. Sadly the 32-bit version and 64-bit version can not coexist. NOTE: This is not advised if you have applications relying on the sql libraries!
In order to get rid of it you can do:

sudo apt-get remove --purge libmysqlclient-dev

At this point you should be all set up but there is one more thing that needs to be addressed. The source is looking for a liblua.so library which didn't exist from the liblua5.1 installation. To manually set it up do:

cd /usr/lib/i386-linux-gnu/
sudo ln -s liblua5.1.so liblua.so

Now the environment is set up so you can run the configure script. We have to force it into 32-bit mode using CPPFLAGS and CXXFLAGS:

CPPFLAGS=-m32 CXXFLAGS=-m32 ./configure
make

At this point it should complete the build and you can continue on to the next section.

Setting Up the Database

If you do not know your mysql root password, the default on most systems is blank. It is a good idea to change this for security reasons, as your mysql root user has full permissions on all databases. The first time you run the mysql client, you should be prompted to change the password. After doing so, you will want to create a user specifically for dealing with the darkstar server database. Run mysql as follows:

mysql -u root -p

Enter your root password at the prompt. Next, create a new user as follows:

CREATE USER 'darkstar'@'localhost' IDENTIFIED BY 'password';

Substitute "password" with a password of your choice. Next, we want to create a database, and set up our new user with permissions to work with it.

CREATE DATABASE dspdb;
USE dspdb;
GRANT ALL PRIVILEGES ON dspdb.* TO 'darkstar'@'localhost';
exit

This will make it to where your new user can do anything necessary, but can only connect from localhost, so even if your password is compromised, it will be difficult to mess with the database remotely. If you need to be able to access the database remotely (like if the database is stored on a separate machine from the server), change the configuration according to the host that will be accessing the database.

replacing "16777343" with the value you determined in your calculation. You should see a message that 256 changes have occured after the update command.

Configuring the Server

Before running your new servers, you will need to update the configuration files to tell it how to talk to the database. You will need to update the files in the conf/ sub-folder named "login_darkstar.conf" "map_darkstar.conf" and "search_server.conf" at a minimum. Find the mysql settings in each and change as appropriate, using the new user, password and database you created earlier.

You may also wish to browse through the various configuration files for any settings that might be of interest to you, but more details on server customization can be found at Customizing Your Server.

Starting the Servers

You may now start your new servers. If you are using a desktop environment, you may wish to open 3 separate terminals and run each server in a separate one to monitor them efficiently. Otherwise, you will want to run them in screen sessions as follows:

This will start and auto-detach all three servers, assigning them meaningful names to make it easy to reattach later by using the commands:

screen -r dsconnect

or

screen -r dsgame

or

screen -r dssearch

to monitor a given server. Once you've attached to a screen, you can detach by first pressing "ctrl+a" and then "d". There are many other useful ways to use screen, so do whatever suits yoru preference.

Your server is now up-and-running, and a client should be able to connect as long as there are no obvious errors on any of the server screens. If the search server is having issues, it is not vital for basic game functionality, but you will be unable to use search functions or the auction house. If you have run into any major issues, contact bluekirby0 (the current maintainer of the linux port as of the time of this writing) on IRC #darkstarproject@irc.rizon.net or in the forums.

Automatic Server Restarts & Crash Logs

If your server goes down, no one can connect. If it goes down when you're not looking, it can be down for an extended period of time. To fix this, you probably want to have a way to have your server auto-restart. In addition, it's good to know when the server crashed.

Launching

Open the shortcuts you created on your desktop, and open the search server as you normally would.

Crash logs will be found in the text files you created in the tools directory showing the date and time the crash occurred.

Problems

In some Windows opperating systems, a window will pop up saying the program has crashed, leaving the crashed program up and preventing an auto-restart. This can be avoided by disabling the user interface for critical errors. To do this follow these steps: