Server Installation




Installation Guide

 

This goes over on how to setup a Solaris 10 virtual machine with the server files. The guide is adapted from other guides online, with my personal mix added in.

 

 

1. Preparations

 

Things you need:

 

1. VMware Workstation 12.5 Player for Windows 64-bit

http://www.vmware.com/products/player/playerpro-evaluation.html

 

2. Talesweaver Server Files

https://mega.nz/#!5MJFzLxY!Eu8zk3NiuSijmd_RU7-FvAdob7rCiA8KIIA6XpooneU

 

3. Talesweaver Client (We use 4.04J for this example)

https://mega.nz/#!AMlUyKBb!AY8igGyuBIIsd2gRSYHBxU6pAcY9UmXaKzVRXtXuNWg

 

4. Solaris 10 1/13 x86 iso

http://www.oracle.com/technetwork/server-storage/solaris10/downloads/index.html

 

5. WinSCP (makes transferring and managing files between computers MUCH easier)

https://winscp.net/eng/download.php

 

(optional) 6. Teraterm or any other preferred SSH terminal client

https://osdn.net/projects/ttssh2/releases/

 

(optional) 7. Notepad++ (for editing various files)

https://notepad-plus-plus.org/download/v7.2.2.html

 

(optional) 8. Locale Emulator (for changing encoding to client language)

http://pooi.moe/Locale-Emulator/

 

Feel free to install or get the portable versions of the various apps. I won't go into details of each one in this guide.

 


2. Setting Up VMware Workstation 12 Player

 

  1. Upon opening up VMware Workstation 12 Player, select Create a New Virtual Machine.
  2. Select Installer disc image file, and choose the sol-10-u11-ga-x86-dvd.iso that you've previously downloaded.
  3. Give it a name (I called it TWServer) 
  4. Allocate at least 20GB
  5. Before you finish, go to Customize Hardware.
  6. Allocate how much RAM you want it to have (I used 2048MB), and also the number of processors (I used 2).
  7. For Network Adapter, choose Bridged mode. Keep Replicate physical network connection state unchecked, go to Configure Adapters, and check only the adapter connected to the internet. You can leave everything else on default.
  8. Now you're ready to start the virtual machine! 

 


3. Installing Solaris 10

 

 

This should also be pretty straight forward.

Basically, unless you know what you're doing, keep picking the default option. Aside from a few things:

 

  1. When asked if you want to use DHCP, choose no, and enter an IP address manually for this VM. Make sure to pick an IP address that your PC can reach.
    Typically, your PC is probably 192.168.1.x, or 192.168.0.x . For the VM, keep the first 3 sets of number the same, and pick a number that doesn't conflict with any machine on the network. In this example, I will use 192.168.1.200
  2. Leave submask as 255.255.255.0
  3. When asked which protocol used to join domain, use none.
  4. For hostname, pick a name you can identify with (I used TWServer) 
  5. Pick a password for root that you can remember, and DO NOT use blank. 
  6. On top of English(posix), also install both of the Japanese language packs, euc and shift-jis
  7. You can more or less leave everything else on default.
  8. Sit back and wait while it installs! 

 

 

 


4. Setting up Solaris

 

4a. Setting up the shell and remote login

 

When you first boot up, you'll be greeted with a login screen. We'll want to use the console though, so go to Options and choose Command Line.

 

 

 

Right off the bat when logged in, run the command bash, because the default shell sucks.

bash 

 

 

We will also allow root login from network, so you can finally use Teraterm to communicate with the server and say goodbye to the VM window.

To do this we need to edit the file /etc/ssh/sshd_config with vi:

vi /etc/ssh/sshd_config 

 

If you've never used vi before, it can get quite confusing. When the file is first opened, vi is in browse mode, so don't immediately start type.

First, use the arrow key to find the line that says:  (It's quite far down)

PermitRootLogin no

 

Hover the cursor over 'n' for no, and press x twice to delete the word.

Now press a to enter edit mode, then type yes so it looks like this:

PermitRootLogin yes

 

Hit Esc to exit edit mode, now we save and quit by typing :wq (Told you it gets weird)

 

Now we can restart the ssh daemon:

/lib/svc/method/sshd restart 

 

and we're done! Open up Teraterm, connect to 192.168.1.200, type in root and password, and viola!

 

Before we move on, let's also set bash as the default shell when we login, amongst other things. Copy the following code and paste it on Teraterm with right click.

usermod -s /usr/bin/bash root
echo "
export PATH=/opt/csw/bin:/usr/sfw/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:$PATH
export PS1=\"[\[\e[35;40m\]\u\[\e[0m\]@\[\e[36;40m\]\h\[\e[0m\] \[\e[0;31m\]\t\[\e[0m\] \[\e[33;40m\]\w\[\e[0m\]]\[\e[0;31m\]\\\\$ \[\e[0m\]\"
" >> ~/.bash_profile
 

 

If you get an error, re-login and try again. Sometimes it needs to refresh before you can write into .bash_profile

 


4b Setting up the Environment

 

Now that we can start copying and pasting code, things are going to speed up!

 

First we need to get internet to work. In this example I assume your router is at 192.168.1.1

cp nsswitch.dns nsswitch.conf
echo "nameserver 192.168.1.1" > /etc/resolv.conf
echo "192.168.1.1" > /etc/defaultrouter

 

 

Restart the server.

 

Now see if it works:

dig @8.8.8.8 www.google.com 

 

If you get a response from Google, you're good to go!

 

 

Now we need to download a few packages. I recommend running these commands one-by-one because it can take a while to download.

cd /export/home
wget http://download.nust.na/pub3/solaris/intel/5.10/ncurses-5.6-sol10-x86-local.gz
wget http://download.nust.na/pub3/solaris/sunfreeware/pub/unixpackages/x86/5.10/gd-2.0.35-sol10-x86-local.gz
wget http://download.nust.na/pub3/solaris/intel/5.10/gcc-3.4.6-sol10-x86-local.gz
wget http://download.nust.na/pub3/solaris/intel/5.10/openssl-0.9.8-sol10-x86-local.gz
wget http://download.nust.na/pub3/solaris/intel/5.8/db-3.3.11-sol8-intel-local.gz

 

Now we gunzip them and install the packages. For each pkgadd, type y to everything. Again, run one at a time

gunzip *.gz
pkgadd -d openssl-0.9.8-sol10-x86-local
pkgadd -d ncurses-5.6-sol10-x86-local
pkgadd -d gcc-3.4.6-sol10-x86-local
pkgadd -d gd-2.0.35-sol10-x86-local
pkgadd -d db-3.3.11-sol8-intel-local 
ln -s /opt/csw/lib/libncurses.so.5 /usr/local/lib/libncurses.so.5
ln -s /opt/csw/lib/libiconv.so.2.5.0 /usr/lib/libiconv.so.2
ln -s /usr/local/lib/libgcc_s.so.1 /lib/libgcc_s.so.1
ln -s /usr/local/lib/libstdc++.so.6.0.3 /lib/libstdc++.so.6
ln -s /usr/local/BerkeleyDB.3.3/lib/libdb-3.3.so /lib/libdb-3.3.so

 

 

It's time to install the TW server files! Back on your PC, first unzip the server somewhere. (eg. C:\Temp1\tw404\ )

Using WinSCP, connect to 192.168.1.200. Now drag the entire folder over to the root directory (/) of the VM. Make sure there's no double folder like \tw404\tw404\

 

After it's done, we need to set permissions for those files.

chmod -R 755 /tw404 

 

 

4c. Setting up MySQL Server

 

We also need to install mysql, one of the databases used by the server.

But first, we remove the existing old versions to avoid conflict: (run these one by one)

pkginfo | grep -i mysql
pkgrm SUNWmysqlr
pkgrm SUNWmysqlt
pkgrm SUNWmysqlu
 

 

We will download, compile and install mysql 5.0.51

mkdir /usr/local
cd /usr/local
wget http://files.directadmin.com/services/all/mysql/mysql-5.0.51.tar.gz
gunzip -cd mysql-5.0.51.tar.gz | gtar xvpf -
cd mysql-5.0.51
# Compile command. this can take a few minutes 
CC=gcc CFLAGS="-O3 -fomit-frame-pointer-DHAVE_CURSES_H" \
CXX=gcc \
CXXFLAGS="-O3 -fomit-frame-pointer-felide-constructors \
-fno-exceptions -fno-rtti-DHAVE_CURSES_H" \
./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/usr/local/mysql/data --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-extra-charsets=all
gmake

#and finally install  
gmake install

 

 

Setting up mysql and users

mkdir /usr/local/mysql/data
groupadd mysql
useradd -g mysql mysql
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/data
chmod -R 770 /usr/local/mysql

 

Setup Solaris to run MySQL Server on startup

cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/
ln /etc/init.d/mysql.server /etc/rc3.d/S99mysql
ln /etc/init.d/mysql.server /etc/rc0.d/K01mysql
cp /usr/local/mysql/share/mysql/my-small.cnf /etc/my.cnf
 

 

Change encoding of MySQL to shift-jis. We need to edit /etc/my.cnf

If you haven't already, setup WinSCP to use Notepad++ for editing by default

 

So using WinSCP or vi, open and edit /etc/my.cnf

vi /etc/my.cnf

 

Find # [client] and add the following line to the end of section

default-character-set=sjis

 

Find # [mysqld] and add the following lines to the end of section

default-character-set = utf8

skip-character-set-client-handshake

character-set-server = utf8

collation-server = utf8_general_ci

init-connect = SET NAMES utf8

 

 

Start MySQL Server for the first time

/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --user=mysql &

 

Initialize database

/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

 

Set root password for mysql

('your password' is your password, 'hostname' is whatever the hostname you picked when Solaris is installed. In this case it's TWServer)

/usr/local/mysql/bin/mysqladmin -u root password 'your password'
/usr/local/mysql/bin/mysqladmin -u root -h 'hostname' password 'your password'
 

 

Connect to MySQL

/usr/local/mysql/bin/mysql -u root -p

 

and enter your password defined just now

 

 

Create user gamedb, which is used by TW server. Again, replace 'hostname' with your hostname where applicable.

Do NOT change 'vlql=nrt' , '6e4637a643a8fc2b' , or 'gamedb'

CREATE USER 'gamedb'@'hostname' IDENTIFIED BY 'vlql=nrt';
GRANT ALL PRIVILEGES ON *.* TO 'gamedb'@'hostname' WITH GRANT OPTION;
UPDATE `mysql`.`user` SET `Password`='6e4637a643a8fc2b' WHERE  `Host`='hostname' AND `User`='gamedb';

 

Initialize dbs used by the game

create database jtales12_account;
create database jtales12_castle;
create database jtales12_episode;
create database jtales12_friendList;
create database jtales12_gamestat;
create database jtales12_group;
create database jtales12_guild;
create database jtales12_pet;
create database jtales12_refuse;
create database jtales12_share;

 

Recreate database structure with correct encoding

use jtales12_account

DROP TABLE IF EXISTS account;
DROP TABLE IF EXISTS delete_character_list;
   
CREATE TABLE `account` (
`tid` int(10) unsigned NOT NULL,
 `tusername` varchar(30) NOT NULL,
 `tpassword` varchar(30) NOT NULL,
 `temail` varchar(50) NOT NULL,
 `tregtime` datetime default NULL,
 `tregip` varchar(45) NOT NULL,
 `id` int(10) unsigned NOT NULL auto_increment,
 `username` varchar(30) NOT NULL,
 `password` varchar(30) NOT NULL,
 `email` varchar(50) NOT NULL,
 `regtime` datetime default NULL,
 `regip` varchar(45) NOT NULL,
 `passwd` varchar(30) NOT NULL,
 PRIMARY KEY  USING BTREE (`id`),
 UNIQUE KEY `UNIQUE` USING BTREE (`tusername`)
) ENGINE=InnoDB DEFAULT CHARSET=sjis ROW_FORMAT=DYNAMIC;
   
CREATE TABLE `delete_character_list` (
`requestdate` datetime NOT NULL,
 PRIMARY KEY  USING BTREE (`requestdate`)
) ENGINE=InnoDB DEFAULT CHARSET=sjis;
   
use jtales12_castle
   
DROP TABLE IF EXISTS castle;
DROP TABLE IF EXISTS castle_entrusted;
DROP TABLE IF EXISTS guardian;
   
CREATE TABLE `castle` (
`castleNum` int(11) NOT NULL default '0',
 `castleName` varchar(50) default NULL,
 `king` varchar(20) default NULL,
 `guild` varchar(20) default NULL,
 `loser` varchar(20) default NULL,
 `state` int(11) NOT NULL default '0',
 `fortitude` int(11) NOT NULL default '0',
 `remainTime` int(11) NOT NULL default '0',
 `victories` int(11) NOT NULL default '0',
 `challengerGuild` varchar(20) default NULL,
 `victoryTick` int(11) NOT NULL default '0',
 `readyGuild` varchar(20) default NULL,
 UNIQUE KEY `castleNum` (`castleNum`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
   
CREATE TABLE `castle_entrusted` (
 `castleNum` int(11) NOT NULL default '0',
 `image` blob
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guardian` (
 `guardianNumber` int(11) NOT NULL default '0',
 `ownerGuildName` varchar(20) NOT NULL default 'NO_NAME',
 `catchedTick` int(10) unsigned NOT NULL default '0',
 UNIQUE KEY `guardianNumber` (`guardianNumber`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
   
use jtales12_episode
 
DROP TABLE IF EXISTS goodwill_data;
DROP TABLE IF EXISTS switch_data;
DROP TABLE IF EXISTS switch_log;
   
CREATE TABLE `goodwill_data` (
`characterid` varchar(32) NOT NULL default '',
 `goodwill` blob NOT NULL,
 PRIMARY KEY  (`characterid`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
   
CREATE TABLE `switch_data` (
`characterid` varchar(32) NOT NULL default '',
 `episode` smallint(5) unsigned NOT NULL default '0',
 `switch` blob NOT NULL,
 UNIQUE KEY `characterId` (`characterid`,`episode`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `switch_log` (
`name` varchar(50) NOT NULL default '',
 `episode` int(11) NOT NULL default '0',
 `tick` int(10) unsigned NOT NULL default '0',
 `log` varchar(250) NOT NULL default '',
 UNIQUE KEY `switchLogUniqueIndex` (`name`,`episode`,`tick`,`log`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
use jtales12_friendList 
 
DROP TABLE IF EXISTS FLfriend;
DROP TABLE IF EXISTS FLgroup;
 
CREATE TABLE `FLfriend` (
`myName` varchar(50) NOT NULL default '',
 `friendName` varchar(50) NOT NULL default '',
 `groupId` int(11) default '0',
 UNIQUE KEY `uIndex` (`myName`,`friendName`),
 KEY `myList` (`myName`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `FLgroup` (
`id` int(11) NOT NULL default '0',
 `name` varchar(50) NOT NULL default '',
 `ownerName` varchar(50) NOT NULL default '',
 UNIQUE KEY `idIndex` (`id`,`ownerName`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
     
use jtales12_gamestat
DROP TABLE IF EXISTS GSMonster;
DROP TABLE IF EXISTS GSSoldItem;
DROP TABLE IF EXISTS GSWorld;
   
CREATE TABLE `GSMonster` (
`monName` varchar(50) NOT NULL default '',
 `level` int(11) default '0',
 `killed` int(11) default '0',
 `updatetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `GSSoldItem` (
`itemName` varchar(50) NOT NULL default '',
 `sold` int(11) default '0',
 `updatetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `GSWorld` (
 `worldName` varchar(50) NOT NULL default '',
 `level` int(11) NOT NULL default '0',
 `inCount` int(11) default '0',
 `stayTime` int(11) default '0',
 `updatetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
     
use jtales12_group
DROP TABLE IF EXISTS member;
 
CREATE TABLE `member` (
`name` varchar(50) NOT NULL default '',
 `team` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `db` int(11) NOT NULL default '0',
 `pk` int(11) NOT NULL default '0',
 `tick` int(11) NOT NULL default '0',
 `level` int(11) NOT NULL default '0',
 `state` bigint(20) unsigned NOT NULL default '0',
 UNIQUE KEY `nameindex` (`name`),
 KEY `teamindex` (`team`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis PACK_KEYS=1;
   
use jtales12_guild
DROP TABLE IF EXISTS guild;
DROP TABLE IF EXISTS guildAnnounce;
DROP TABLE IF EXISTS guildBank;
DROP TABLE IF EXISTS guildBankLog;
DROP TABLE IF EXISTS guildLog;
DROP TABLE IF EXISTS guildMember;
   
CREATE TABLE `guild` (
`name` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `subType` int(11) NOT NULL default '0',
 `birthTick` int(10) unsigned NOT NULL default '0',
 `markType` int(11) NOT NULL default '0',
 `markResourceId` int(10) unsigned NOT NULL default '0',
 `level` int(11) NOT NULL default '0',
 `acceptMinLevel` int(11) NOT NULL default '0',
 `acceptMaxLevel` int(11) NOT NULL default '0',
 `hpUrl` varchar(80) NOT NULL default '',
 `intro` varchar(250) NOT NULL default '',
 `exp` int(10) unsigned NOT NULL default '0',
 `goodwill` int(10) unsigned NOT NULL default '0',
 `voteTick` int(10) unsigned NOT NULL default '0',
 `taxLevied` int(11) NOT NULL default '0',
 `currentTax` int(11) NOT NULL default '0',
 `taxDelayed` int(11) NOT NULL default '0',
 `collectingTaxTick` int(10) unsigned NOT NULL default '0',
 `taxDelayMonth` int(11) NOT NULL default '0',
 `state` int(10) unsigned NOT NULL default '0',
 UNIQUE KEY `guildNameIndex` (`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guildAnnounce` (
`name` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `tick` int(10) unsigned NOT NULL default '0',
 `announce` varchar(250) NOT NULL default '',
 UNIQUE KEY `guildAnnounceUniqueIndex` (`name`,`type`,`tick`,`announce`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guildBank` (
`guildName` varchar(50) NOT NULL default '',
 `guildType` int(11) NOT NULL default '0',
 `attribute` blob NOT NULL,
 UNIQUE KEY `guildBankIndex` (`guildName`,`guildType`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guildBankLog` (
`name` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `tick` int(10) unsigned NOT NULL default '0',
 `log` varchar(250) NOT NULL default '',
 UNIQUE KEY `guildBankLogUniqueIndex` (`name`,`type`,`tick`,`log`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guildLog` (
`name` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `tick` int(10) unsigned NOT NULL default '0',
 `log` varchar(250) NOT NULL default '',
 UNIQUE KEY `guildLogUniqueIndex` (`name`,`type`,`tick`,`log`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
CREATE TABLE `guildMember` (
`name` varchar(50) NOT NULL default '',
 `type` int(11) NOT NULL default '0',
 `guildName` varchar(50) NOT NULL default '',
 `guildType` int(11) NOT NULL default '0',
 `title` varchar(50) NOT NULL default '',
 `DBID` int(11) NOT NULL default '0',
 `level` int(11) NOT NULL default '0',
 `joinTick` int(10) unsigned NOT NULL default '0',
 `resignTick` int(10) unsigned NOT NULL default '0',
 `rank` int(11) NOT NULL default '0',
 `vote` int(11) NOT NULL default '0',
 `logoutTick` int(10) unsigned NOT NULL default '0',
 `exp` int(10) unsigned NOT NULL default '0',
 `state` int(10) unsigned NOT NULL default '0',
 UNIQUE KEY `guildMemberNameIndex` (`guildName`,`guildType`,`name`),
 KEY `guildMemberIndex` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
use jtales12_pet
DROP TABLE IF EXISTS pet;
   
CREATE TABLE `pet` (
 `owner` varchar(16) NOT NULL default '',
 `type` int(11) NOT NULL default '-1',
 `nutrition` int(11) NOT NULL default '0',
 `nutritionTick` int(11) NOT NULL default '0',
 `sanitation` int(11) NOT NULL default '0',
 `sanitationTick` int(11) NOT NULL default '0',
 `remainTime` int(11) NOT NULL default '0',
 `eggid` varchar(8) NOT NULL default 'NO_NAME',
 `dbid` varchar(8) NOT NULL default 'NO_NAME',
 `color` int(11) NOT NULL default '0',
 `name` varchar(32) NOT NULL default 'Pet',
 `level` int(11) NOT NULL default '0',
 `vital` int(11) NOT NULL default '0',
 `exp` int(11) NOT NULL default '0',
 `birthTime` int(11) NOT NULL default '0',
 `bHibernated` int(11) NOT NULL default '0',
 `partnerOwner` varchar(16) NOT NULL default 'NO_NAME',
 `partner` int(11) NOT NULL default '0',
 `cleanItem` blob NOT NULL,
 `nutritionItem` blob NOT NULL,
 `foodItem` blob NOT NULL,
 `skills` blob,
 UNIQUE KEY `owner` (`owner`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
   
use jtales12_refuse
 
DROP TABLE IF EXISTS refuse;
 
CREATE TABLE `refuse` (
 `ownerName` varchar(50) NOT NULL default '',
 `otherName` varchar(50) NOT NULL default '',
 UNIQUE KEY `uIndex` (`ownerName`,`otherName`),
 KEY `myList` (`ownerName`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 
use jtales12_share
DROP TABLE IF EXISTS share;
   
CREATE TABLE `share` (
 `idx` int(11) NOT NULL auto_increment,
 `receiver` varchar(16) NOT NULL default '',
 `sender` varchar(16) NOT NULL default '',
 `time` int(11) NOT NULL default '0',
 `image` blob,
 `seed` int(11) NOT NULL default '0',
 UNIQUE KEY `shareItemIndex` (`idx`,`receiver`,`sender`)
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
 

 

Exit out of MySQL

quit; 

 

Phew. That was long. Just a little bit more!

 


4d. Setting up the Game Server

 

We need to edit each of these three files and change the IP to your server's internal IP:

If you use Notepad++, you can highlight one instance of the old IP, type Ctrl-H to open the Replace dialogue, and replace with your current IP

/tw404/db/DB.cfg

/tw404/jtales*/table/DBs.jtales

/tw404/jtales*/table/Servers.jtales

 

IMPORTANT:

Until we find out how to bypass the check, the server kicks you immediately if the server time is current.

So for now, we need to set the server date to something old. (I've heard somebody in Japan has succeeded in bypassing the date check by hex-editing the jtales file. But he won't share how he did it so we're on our own >_>)

(date format is mmddHHMMYY, eg this sets date to 00:00 Jan 1, 2003)

date 0101000003 

 

 

You're now technically ready to start the server!

 

Let's just first testing and see if everything works.

open up 4 instances of ssh connections in root

 

On first window, we'll start the db server responsible for storing master account and character files

cd /tw404/db
./db -l ./logs/$LOGFILE.log

 

Second window, this is in charge of the login server

cd /tw404/jtales0
./jtales -d 12 jtales0

 

Third window, the first world server

cd /tw404/jtales1
./jtales -d 12 jtales1

 

And last but not least, the second world server 

cd /tw404/jtales2
./jtales -d 12 jtales2 

 

The game server files are designed to be able to run different regional servers for different responsibilities.

By configuring /tw404/jtales*/table/Servers.jtales , you can add or remove world servers and designate certain maps for certain servers. (Defined in Maps.jtales)

But for the scope of this guide, we will leave it as is.

Also, instead of doing it manually every time we can setup a script to start the relevant servers. More on that later

 

We're now ready to connect with game client!


4e. Setting up Game Client

 

First we go back to the PC and locate the client folder. If you installed it from the official installer, it'll probably be at C:\Program Files (x86)\Nexon\Talesweaver or something

 

Windows 10 compatibility

This will emulate the application in 16bit color mode, which the game client requires to run correctly in in windowed mode. (At least in 4.04)

 

Game shortcut

Inside this folder, we will create a new batch file. Let's call it Launch Game.bat for example.

Edit it in Notepad and we in a line like this:

start InphaseNXD.EXE /USE_SERVER 12 /ADDR xxxxxxxxxx /PORT 40000
goto end
 

 

We will replace xxxxxxxxxx with what would translate into your game server IP.

 

Math incoming! Here we need to do a little math.

Open up your scientific calculator, and follow this formula. If our server IP is 192.168.1.200, we do:

 

{ [ 200 * 256^3 ] + [ 1 * 256^2 ] + [ 168 * 256^1 ] + 192 }

 

You should get the answer 3355551936. So we replace /ADDR xxxxxxxxxx with /ADDR 3355551936 .

Save the file, and run the game with the batch file!

 

Alternatively, you can search for any IP to Long calculator and punch in the IP there.

HOWEVER, you'll need to reverse the numbers or it wouldn't work.

     eg. For 12.34.56.78 enter as 78.56.34.12

 

 


(optional) Locale Emulator

If you have Locale Emulator installed, right click on InphaseNXD.EXE -> Locale Emulator -> then Modify Application Profile.

In Enter argument here, put this part of the previous section here: (again, replace xxxxxxxxxx with the converted IP)

/USE_SERVER 12 /ADDR xxxxxxxxxx /PORT 40000

 

For Location, select Japanese (Japan).

 

And finally, click Create Shortcut and the game will launch in the proper encoding.

Next time you run the client, you InphaseNXD.EXE -> Locale Emulator -> then Run with Application Profile.


 

 

When asked for login credentials, just use username test and password test for now.

You can create a new character or just use the one supplied.

We will cover account creation in another section. The in-game account creation does not work as of writing.

 

Fingers crossed. And if it all goes well, you have successfully logged in!

 

This concludes this part of the guide. For other stuff like account creation, look for the respective sections!

Thank you for reading and I hope this helps you kick start your own server!

 

 


 

Other useful stuff from Japanese wiki

 

Symlink some folders of jtales0 to jtales1 and jtales2 so only need to edit jtales0 most of the time

 

#====================================================================================

# 編集するであろうディレクトリのシンボリックリンク作成

#====================================================================================

# 毎回jtales1、jtales2にコピーするのはめんどくさいので、一部ディレクトリにシンボリックリンクを張ってjtales0のみを編集することにした

 

# 1.jatles1、jatles2のquest、quest_data、tableディレクトリをバックアップ

mv /tw404/jtales1/quest /tw404/jtales1/quest_bk

mv /tw404/jtales1/quest_data /tw404/jtales1/quest_data_bk

mv /tw404/jtales1/table /tw404/jtales1/table_bk

mv /tw404/jtales2/quest /tw404/jtales2/quest_bk

mv /tw404/jtales2/quest_data /tw404/jtales2/quest_data_bk

mv /tw404/jtales2/table /tw404/jtales2/table_bk

 

# 2.jtales0からシンボリックリンク作成

ln -s /tw404/jtales0/quest /tw404/jtales1/quest

ln -s /tw404/jtales0/quest_data /tw404/jtales1/quest_data

ln -s /tw404/jtales0/table /tw404/jtales1/table

ln -s /tw404/jtales0/quest /tw404/jtales2/quest

ln -s /tw404/jtales0/quest_data /tw404/jtales2/quest_data

ln -s /tw404/jtales0/table /tw404/jtales2/table

 

# 3.ファイル確認

ls -ld /tw404/jtales*/table

ls -ld /tw404/jtales*/quest

ls -ld /tw404/jtales*/quest_data

 

# 出力例

# [root@Tales 00:52:58 /]# ls -ld /tw404/jtales*/table

# drwx------ 2 root root 2048 1月 2 2004 /tw404/jtales0/table

# lrwxrwxrwx 1 root root 20 1月 2 2004 /tw404/jtales1/table -> /tw404/jtales0/table

# lrwxrwxrwx 1 root root 20 1月 2 2004 /tw404/jtales2/table -> /tw404/jtales0/table

# [root@Tales 00:53:08 /]# ls -ld /tw404/jtales*/quest

# drwx------ 2 root root 17920 1月 2 2004 /tw404/jtales0/quest

# drwx------ 2 root root 17920 1月 4 2016 /tw404/jtales1/quest

# drwx------ 2 root root 17920 1月 4 2016 /tw404/jtales2/quest

# [root@Tales 00:53:21 /]# ls -ld /tw404/jtales*/quest_data

# drwx------ 4 root root 512 1月 2 2004 /tw404/jtales0/quest_data

# lrwxrwxrwx 1 root root 25 1月 2 2004 /tw404/jtales1/quest_data -> /tw404/jtales0/quest_data

# lrwxrwxrwx 1 root root 25 1月 2 2004 /tw404/jtales2/quest_data -> /tw404/jtales0/quest_data

 

 

Start and Stop scripts

 

#====================================================================================

# サーバ起動スクリプト作成およびサーバ起動

#====================================================================================

# 1.ファイル作成

touch /tw404/startTWserver.sh

 

# 2.権限変更

chmod 700 /tw404/startTWserver.sh

 

# 3.ファイル編集(winSCPからでもOK。その場合は文字コードをSJIS、改行コードをLFにすること)

vi /tw404/startTWserver.sh

 

# 以下貼り付け

# ※※※↓↓↓ 張り付けここから ↓↓↓※※※

#!/usr/bin/bash

 

#=====================================================

# 起動ログ書き込みfunction

# $1:プロセス名

#=====================================================

Fnc_START_PROC() {

  STARTDATE=`date +"%Y/%m/%d %H:%M:%S"`
   LOG_FILE=/tw404/logs/$1.log
   
   # ログファイル存在チェック
   LOG_FILE_CHECK=`ls $LOG_FILE 2>/dev/null`
   
   # 既にある場合は改行入れる
   if [ "$LOG_FILE_CHECK" != "" ];then
       echo >> $LOG_FILE
       echo >> $LOG_FILE
   fi
   echo "#--------------------------------------------------------------------------------------" >> $LOG_FILE
   echo "#   $STARTDATE [$1] START" >> $LOG_FILE
   echo "#--------------------------------------------------------------------------------------" >> $LOG_FILE

}

 

# MySQL起動

/etc/init.d/mysql.server start

 

# logsフォルダ作成

mkdir -p /tw404/logs

 

# db起動

Fnc_START_PROC db

cd /tw404/db

./db >> /tw404/logs/db.log &

 

# jtales起動

list="0 1 2"

for n in ${list};do

  Fnc_START_PROC jtales${n}
   cd /tw404/jtales${n}
   ./start  >> /tw404/logs/jtales${n}.log & 

done

 

# 60秒置きに監視して落ちているプロセスがあれば再起動する

while [ "a" != "b" ];do

  db_check=`ps -ef|grep ./db|grep -v grep`
   if [ "${db_check}" = "" ];then
       Fnc_START_PROC db
       cd /tw404/db
       ./db >> /tw404/logs/db_`date +"%Y%m%d"`.log &
   fi
   
   jtales0_check=`ps -ef|grep "./jtales -d 12 jtales0"|grep -v grep`
   if [ "${jtales0_check}" = "" ];then
       Fnc_START_PROC jtales0
       cd /tw404/jtales0
       ./start  >> /tw404/logs/jtales0.log &
   fi
   
   jtales1_check=`ps -ef|grep "./jtales -d 12 jtales1"|grep -v grep`
   if [ "${jtales1_check}" = "" ];then
       Fnc_START_PROC jtales1
       cd /tw404/jtales1
       ./start  >> /tw404/logs/jtales1.log &
   fi
   
   jtales2_check=`ps -ef|grep "./jtales -d 12 jtales2"|grep -v grep`
   if [ "${jtales2_check}" = "" ];then
       Fnc_START_PROC jtales2
       cd /tw404/jtales2
       ./start  >> /tw404/logs/jtales2.log &
   fi
   sleep 60

done

# ※※※↑↑↑ 張り付けここまで ↑↑↑※※※

 

# 4.サーバ起動

/tw404/startTWserver.sh

 

# ※以下のログファイルが作成されるため、設定変更などの影響を調べる際はtailコマンドなどで確認するといい

# ログファイル名

# ・/tw404/logs/db.log

# ・/tw404/logs/jtales0.log

# ・/tw404/logs/jtales1.log

# ・/tw404/logs/jtales2.log

 

# ログファイル「/tw404/logs/jtales1.log」を確認する場合の例

# tail -f /tw404/logs/jtales1.log

 

#====================================================================================

# 停止スクリプト作成

#====================================================================================

# startTWserver.shが起動している窓でCtrl+Cを押せばサーバのプロセスは停止するが

# たまに止まらないことがあるのでそういう時用に用意

 

# 1.ファイル作成

touch /tw404/endTWserver.sh

 

# 2.権限変更

chmod 700 /tw404/endTWserver.sh

 

# 3.ファイル編集(winSCPからでもOK。その場合は文字コードをSJIS、改行コードをLFにすること)

vi /tw404/endTWserver.sh

# 以下貼り付け

# ※※※↓↓↓ 張り付けここから ↓↓↓※※※

# DBプロセスKILL

DB_PROC_ID=`ps -ef|grep "./db"|grep -v grep|awk '{print $2}'`

[ "$DB_PROC_ID" ] && kill -9 $DB_PROC_ID >/dev/null

 

# jtales0プロセスKILL

JTALES_PROC_0=`ps -ef|grep "./jtales -d 12 jtales0"|grep -v grep|awk '{print $2}'`

[ "$JTALES_PROC_0" ] && kill -9 $JTALES_PROC_0 >/dev/null

 

# jtales1プロセスKILL

JTALES_PROC_1=`ps -ef|grep "./jtales -d 12 jtales1"|grep -v grep|awk '{print $2}'`

[ "$JTALES_PROC_1" ] && kill -9 $JTALES_PROC_1 >/dev/null

 

# jtales2プロセスKILL

JTALES_PROC_2=`ps -ef|grep "./jtales -d 12 jtales2"|grep -v grep|awk '{print $2}'`

[ "$JTALES_PROC_2" ] && kill -9 $JTALES_PROC_2 >/dev/null

# ※※※↑↑↑ 張り付けここまで ↑↑↑※※※

 

# 4.サーバ停止

/tw404/endTWserver.sh

 

 

Account Creation

 

#====================================================================================

# クライアント設定

#====================================================================================

# 1.TW404J.exeからクライアントをインストール

 

# 2.win10使用時は16bitカラーにできないので、InphaseNXD.EXEのプロパティを以下の通り設定する。

# ①InphaseNXD.EXEを右クリック>プロパティ

# ②互換性タブをクリック

# ③設定の「カラーモードを制限する」にチェックを入れて16bitカラーにする

 

# 3.起動用バッチファイル作成

TWインストールフォルダに「twclient_start.bat」という名前のテキストファイルを作成

 

# 4.起動用バッチファイル編集 ※鯖IPが192.168.1.86でない場合、ADDRの引数は鯖の建て方ページ「③クライアントファイルを開く」を見て編集すること

# 右クリックして以下の通り編集

start InphaseNXD.EXE /USE_SERVER 12 /ADDR 1442949312 /PORT 40000

goto end

 

#====================================================================================

# アカウント作成

#====================================================================================

# 1.3.5鯖を起動して以下ファイルをWinSCPでダウンロード

・/tw/db/master/create_master

・/tw/db/master/README_uh

・/tw/db/master/uh

 

# 2.4.04の「/tw404/db/master/」にwinSCPでアップロード

 

# 3.teratermでログイン後、「/tw404/db/master/」に移動

cd /tw404/db/master/

 

# 4.権限変更

chmod 777 /tw404/db/master/create_master

chmod 777 /tw404/db/master/README_uh

chmod 777 /tw404/db/master/uh

 

# 5.アカウント作成

# ※項番7で詳しく書くが、このままではハッシュ値が異なるため使用できない

#

# 書式

# ./create_master <ユーザID> <パスワード> <メールアドレス> <誕生日> <リアルネーム> <作成日> <チケット期限?> <太陽?> <性別>

# 例:ID:tales PW:talesで作成する場合(ID、PW以外はなんでもいい?メアドはかぶっちゃダメかもしれない)

# ./create_master tales tales 1@tales.com 20151119 1 99999 999999 4 5

 

# 6.アカウント作成確認

find /tw404/db/master -name "<項番5で指定したアカウント名>"

 

# 7.Win上で起動後初回ログイン(失敗)

# dbのログに「master/04/ee/<アカウント名>」などでログが出力されるので、「04/ee」の部分の英数字を控える

 

# 8.アカウントファイル移動

mv <項番5の出力結果> /tw404/db/master/<項番6で確認した数値1>/<項番6で確認した数値2>

# 実行例

# mv /tw404/db/master/01/e0/tales /tw404/db/master/04/ee

 

# 9.鯖再起動

# Ctrl+Cで鯖の停止を行う

/tw404/endTWserver.sh;/tw404/startTWserver.sh;

 

# 10.Win上でクライアント再起動後再ログイン

 

#====================================================================================

# クライアント設定

#====================================================================================

# 1.TW404J.exeからクライアントをインストール

 

# 2.win10使用時は16bitカラーにできないので、InphaseNXD.EXEのプロパティを以下の通り設定する。

# ①InphaseNXD.EXEを右クリック>プロパティ

# ②互換性タブをクリック

# ③設定の「カラーモードを制限する」にチェックを入れて16bitカラーにする

 

# 3.起動用バッチファイル作成

TWインストールフォルダに「twclient_start.bat」という名前のテキストファイルを作成

 

# 4.起動用バッチファイル編集 ※鯖IPが192.168.1.86でない場合、ADDRの引数は鯖の建て方ページ「③クライアントファイルを開く」を見て編集すること

# 右クリックして以下の通り編集

start InphaseNXD.EXE /USE_SERVER 12 /ADDR 1442949312 /PORT 40000

goto end

 

#====================================================================================

# アカウント作成

#====================================================================================

# 1.3.5鯖を起動して以下ファイルをWinSCPでダウンロード

・/tw/db/master/create_master

・/tw/db/master/README_uh

・/tw/db/master/uh

 

# 2.4.04の「/tw404/db/master/」にwinSCPでアップロード

 

# 3.teratermでログイン後、「/tw404/db/master/」に移動

cd /tw404/db/master/

 

# 4.権限変更

chmod 777 /tw404/db/master/create_master

chmod 777 /tw404/db/master/README_uh

chmod 777 /tw404/db/master/uh

 

# 5.アカウント作成

# ※項番7で詳しく書くが、このままではハッシュ値が異なるため使用できない

#

# 書式

# ./create_master <ユーザID> <パスワード> <メールアドレス> <誕生日> <リアルネーム> <作成日> <チケット期限?> <太陽?> <性別>

# 例:ID:tales PW:talesで作成する場合(ID、PW以外はなんでもいい?メアドはかぶっちゃダメかもしれない)

# ./create_master tales tales 1@tales.com 20151119 1 99999 999999 4 5

 

# 6.アカウント作成確認

find /tw404/db/master -name "<項番5で指定したアカウント名>"

 

# 7.Win上で起動後初回ログイン(失敗)

# dbのログに「master/04/ee/<アカウント名>」などでログが出力されるので、「04/ee」の部分の英数字を控える

 

# 8.アカウントファイル移動

mv <項番5の出力結果> /tw404/db/master/<項番6で確認した数値1>/<項番6で確認した数値2>

# 実行例

# mv /tw404/db/master/01/e0/tales /tw404/db/master/04/ee

 

# 9.鯖再起動

# Ctrl+Cで鯖の停止を行う

/tw404/endTWserver.sh;/tw404/startTWserver.sh;

 

# 10.Win上でクライアント再起動後再ログイン