You're not registered yet. Click here to register. Credits 
You can register here for free.
This topic has 13 replies
and has been read 1.256 times
 Questions about server and network games
Scotty Offline

Administrator


Posts: 3.605

Sun Nov 25, 2012 3:32 pm
How to run an own game server Quote · reply

First of all, you don't need to run a server for just a game with known friends. It's simpler to use the built in "local network" connection that provides all networking functionality as well. An own game server makes no sense until you want to play with a really huge number of friends, or if you want to run a service on a 24/7 basis for your country for instance.

The application itself can be found on SF.net. If you want to run it on ARM CPU (e.g. my server hardware is a Sheeva) select ScrabbleServer-arm, otherwise i386, both are 32bit Linux. You need to have an open port 5001, a mySQL server (v5.0), and some space on this server. The mySQL server should have a database (e.g Scrabble3D) with the table "Users" (this name is fixed). In that table some fields should be defined:

1
2
3
4
5
6
7
8
9
10
11
12
 
Name 	text
Passwd text
Key int(11) auto_increment
GamesPlayed int(11)
Rating int(11)
Registered datetime
LastConnect datetime
LastIP text
LastMac text
Messages text
AllowKibitz tinyint(1)
Email varchar(255)
 


The server is not a daemon. That means you can run it in a terminal but when the terminal is closed the program would be shut down. I'm using screen to detach the program.

You can start the program with or without parameters.

1
2
3
4
5
6
7
 
ScrabbleServer v0.2
Parameters:
-u <user>
-p <password>
-d <database>
-h (Shows this help)
 
 

The program will ask for those parameters that are not given on startup.
After some checks the server is started. Errors are reported in /var/log/Scrabble3D but most information is just written into the console.
Each game will be saved as a single file with a running number as name. Files are tar'ed into backup.tar. You can define this time and some variables in ScrabbleServer.ini (without //comments)

1
2
3
4
5
6
7
8
9
10
11
12
 
[News]
Current=Welcome to the Free International Scrabble3D Server! //Message shown on connect
 
[General]
GameNumber=43834 //internal value
MaxDaysForStoredGames=7 //games that are not accessed within this time are backed up
NumberOfBestPlayers=20 //how many players are reported on best info
MaxNumberOfAccounts=3 //max number of accounts per user (MAC address counts)
TimeToAfk=600000 //time without action until user is treated as away from keyboard in ms
 
[Banned_UID]
94:0c:6d:bf:40:d3=0 //you can ban users based on their MAC address; set value to 1 to activate
 



Make sure your server allows TCP connection on port 5001; usually the router needs configuration on network/port access translation, NAT/PAT. The first way to allow others to connect is to give them your IP address respectively a dynamic domain name. This address can be "hacked" into Scrabble3D.ini

1
2
3
 
[Server]
Free International Scrabble3D Server=scrabble.game-server.cc
Sheeva=192.168.2.102
 

The first entry is the alias of your server, the second one the corresponding address. In the example my Sheeva server can be accessed not only via dynamic DNS as FISS but as well with the name Sheeva at the (local) IP address.

The second way to make your address public is to ask here. The information about your server can be transmitted to all users during the update procedure. But please ask only if you want to provide a real and unique 365/24/7 service.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Fluffkat ( Guest )
Posts:

Wed Jan 08, 2014 11:53 pm
#2 RE: How to run an own game server Quote · reply

I am attempting to run the Scrabble3D server on a RaspberryPi using the Rasperian Debian distro. Unfortunately the lowest available version of MySQL for this distro is 5.5. Is there any way to enable the server to use the SQL client 5.5?

I get the following errors when I try to run it at the moment:

Fatal error: TMySQL50Connection can not work with the installed MySQL client version: Expected (5.0), got (5.5.33).

Many thanks in advance,

Ian


Scotty Offline

Administrator


Posts: 3.605

Thu Jan 09, 2014 12:41 am
#3 RE: How to run an own game server Quote · reply

To my knowledge there is no way to run some kind of legacy mode to use a current database with older connectors. It would be much easier to compile the server for 5.5 (and perhaps to upgrade my Sheeva too). I'll check it the next days.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Fluffy ( Guest )
Posts:

Thu Jan 09, 2014 2:12 am
#4 RE: How to run an own game server Quote · reply

Thanks for the fast reply Scotty, and thanks again for making an amazing program! I spend a lot of time travelling and its nice to play the game with friends and family back home! hopefully once the server is working I can leave it up as another dedicated server.

Many thanks again,

Fluffy


Scotty Offline

Administrator


Posts: 3.605

Fri Jan 10, 2014 2:16 pm
#5 RE: How to run an own game server Quote · reply

I compiled the server for MySql 5.5 connectors and uploaded it as ScrabbleServer_5.5-arm.tar.gz to https://sourceforge.net/projects/scrabble/files/Server/. Please report how it works.

Additionally to the first posting the server can send emergency emails

1
2
 
[General]
AdminEmail=nobody@nowhere.com //send an email to this address for warnings and errors
 

The variable NumberOfBestPlayers is obsolete now.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Fluffy ( Guest )
Posts:

Sat Jan 11, 2014 12:13 pm
#6 RE: How to run an own game server Quote · reply

Nearly there! and thanks for recompiling the server code :) am getting the following error when running the server, I am guessing something isn't quite right in my setup! :-

Info [2014-01-11 11:07:59.628 Scrabble3D] 11-1-14 11:07:59: Server started
An unhandled exception occurred at $000A3128 :
EVariantTypeCastError : Could not convert variant of type (Null) into type (Int64)
$000A3128
$00099008

I have configured the database as per the instructions above.

Many thanks again,

Ian


fluffy ( Guest )
Posts:

Sat Jan 11, 2014 12:17 pm
#7 RE: How to run an own game server Quote · reply

p.s. the server doesn't appear to have got as far as writing a log file yet :)

Thanks again,

Ian


Fluffy ( Guest )
Posts:

Sat Jan 11, 2014 12:30 pm
#8 RE: How to run an own game server Quote · reply

Here is an PHP MyAdmin SQL dump of my Database structure as well if that helps!

-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 11, 2014 at 11:27 AM
-- Server version: 5.5.33
-- PHP Version: 5.4.4-14+deb7u7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `Scrabble3D`
--

-- --------------------------------------------------------

--
-- Table structure for table `Users`
--

CREATE TABLE IF NOT EXISTS `Users` (
`Name` text,
`Passwd` text,
`Key` int(11) NOT NULL AUTO_INCREMENT,
`GamesPlayed` int(11) DEFAULT NULL,
`Rating` int(11) DEFAULT NULL,
`Registered` datetime DEFAULT NULL,
`LastConnect` datetime DEFAULT NULL,
`LastIP` text,
`LastMac` text,
`Messages` text,
`AllowKibitz` tinyint(1) DEFAULT NULL,
`Email` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Key`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Scotty Offline

Administrator


Posts: 3.605

Sat Jan 11, 2014 2:03 pm
#9 RE: How to run an own game server Quote · reply

First idea: Please try to create a new data entry. I calculate the best value after server start and this might fail if no data are available.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 

with TWanTCPServer.Create(cPort,_user,_passwd,_database) do
try
//find highest value
Query.Active:=false;
Query.SQL.Text := 'SELECT * FROM Users ORDER BY Rating DESC';
Query.Active:=true;
Query.First;
Best:=Query.FieldValues['Rating'];
 
Start;
 
repeat
sleep(10);
until Keypressed or Terminated;
finally
//Free; //FreeOnTerminate = true
end;
 
 



I do not log much info to file, only warnings and errors, since space is limited on my Sheeva.

PS: How do I read out the sql structure? I see it only in phpmyadmin.


Feld Typ Kollation Attribute Null Standard Extra Aktion
Name text utf8_unicode_ci Nein keine
Passwd text utf8_unicode_ci Nein keine
Key int(11) Nein keine auto_increment
GamesPlayed int(11) Nein keine
Rating int(11) Nein keine
Registered datetime Nein keine
LastConnect datetime Nein keine
LastIP text utf8_unicode_ci Nein keine
LastMac text utf8_unicode_ci Nein
Messages text utf8_unicode_ci Nein
AllowKibitz tinyint(1) Nein keine
Email varchar(255) utf8_unicode_ci Nein


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


fluffy Offline



Posts: 3

Sat Jan 11, 2014 6:52 pm
#10 RE: How to run an own game server Quote · reply

It works!!! I ran the following Query in PhpMyAdmin to populate the table:

INSERT INTO `Users`(`Name`, `Passwd`, `Key`, `GamesPlayed`, `Rating`, `Registered`, `LastConnect`, `LastIP`, `LastMac`, `Messages`, `AllowKibitz`, `Email`)
VALUES ('testuser','password','1','1','1000','12/08/2012','12/08/2012','192.168.1.1','11111111','blah','1','test@test.com');

Now the server runs without errors! thanks for your advice :)

and to generate the database creation SQL Code you can do the following:

1. Open Phpmyadmin (eg mysever/phpmyadmin/)
2. Navigate to the Scrabble3d database
3. Click on the users table
4. Click on the export tab
5. Choose 'Quick' and ensure the format is selected as SQL
6. Click 'Go'

This will download the database structure in SQL format.

Hope this helps and again thanks for taking the time to look at this for me! I'll put together a quick how-to for the raspberryPI shortly

Best regards,

Ian


fluffy Offline



Posts: 3

Sat Jan 11, 2014 7:14 pm
#11 RE: How to run an own game server Quote · reply

OSX Scrabble3D.ini file - I originally posted a question relating to the location of the Scrabble3D.ini file for OSX
I have now found it! - /Users/Ian/.config/Scrabble3D/Scrabble3D.ini

Regards,

Ian


Scotty Offline

Administrator


Posts: 3.605

Sat Jan 11, 2014 8:31 pm
#12 RE: How to run an own game server Quote · reply

Zitat von fluffy im Beitrag #10
It works!!!

Great! I use screen to detach myself from the terminal. And DynDNS as well as FreeDNS for dynamic IP addresses (the second because I don't trust DynDNS anymore). If you want to populate your server to the world, send me your address and a plain name. Those information are part of the autoupdate process, and will be distributed to all users.
Zitat von fluffy im Beitrag #10

4. Click on the export tab
5. Choose 'Quick' and ensure the format is selected as SQL


Not in my admin tool ;-). But that doesn't matter.
If you are an PHP expert you might contribute to the project. I'd like to separate the registration from the login. Usually a link opens a web page, you enter there name, password and email, and all is validated, can be changed later or used in case of a forgotten password. Additionally I'd like to enter the origin information there. I found a simple snippet on the web but without the latter stuff. Perhaps you can help.
Zitat von fluffy im Beitrag #11
OSX Scrabble3D.ini file - I originally posted a question relating to the location of the Scrabble3D.ini file for OSX
I have now found it! - /Users/Ian/.config/Scrabble3D/Scrabble3D.ini

The location of the ini file depends on the OS (and setup - if the ini file is placed at the same directory as the app this path will be used). As a convenience feature the effective address can be found in the configuration, and opened directly in the standard file browser.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


fluffy Offline



Posts: 3

Sun Jan 12, 2014 3:11 pm
#13 RE: How to run an own game server Quote · reply

Hi Scotty,

I Think setting up some web pages to register, retrieve and update info should be relatively straight forward. Im a bit busy this week with work but would love to look at doing this.
The only bit which might be tricky is making sure the database/server is secure and protected from anything malicious (I think that might be the time consuming part!).

I'll take a look at it and send over some ideas for you to look at next weekend if that works? I'm a firm believer in keep it simple so will see what I can find out!

Best regards,

Ian

P.s. thanks again for your help with getting the server up and running! Once I have proven the installation to be stable and my broadband connection to be good enough I'll send over the details for inclusion if you like :)

P.s. I started the server automatically on booting the pi by using the following commands to add it to the rc.conf file on Raspberian

1
 
sudo nano /etc/rc.local
 



Then adding the following line: (scrabble server is the name of the server executable on my server)

1
 
sudo /home/pi/./ScrabbleServer -u DATABASE_USERNAME -p DATABASE_PASSWORD -d DATABASE_NAME 
 


Scotty Offline

Administrator


Posts: 3.605

Sun Jan 12, 2014 3:24 pm
#14 RE: How to run an own game server Quote · reply

Zitat von fluffy im Beitrag #13
I'll take a look at it and send over some ideas for you to look at next weekend if that works?
Sounds good.

About starting the server: Keep in mind that the '-p ****'-option is a security risk since it unveils your password (e.g. per 'ps ax |grep ScrabbleServer').


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


«« Notification
 Jump  
disconnected Scrabble3D Chat Members online 0
Xobor Einfach ein eigenes Forum erstellen