Dedicated server for TMO/TMS/TMN : final release

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

Marck
happy cruiser
happy cruiser
Posts: 113
Joined: 19 Apr 2006 16:24
Location: Germany

Post by Marck » 30 Jun 2006 07:30

eyez wrote:Maybe a "refresh" option is something for the next release?
Yes, along with a new option for CallVote() to specify a custom text. ;)

On the other hand, the AddChallenge/RemoveChallenge scheme may be more efficient than a complete rescan of a Tracks directory with many challenge files.
Do they generally take a low priority if the server is under a heavy load? Or are the slowdowns most likely to be within the code that is executing them?
Well, without having a look into the Aseco code the only thing I can tell you is that any PHP program which uses GbxRemote.inc.php is expected to poll from a list where callbacks received from a dedicated server are buffered. It depends mainly on the implementation how frequently such polls are performed. Furthermore, PHP is an interpreted scripting language which can be a performance bottleneck if not used with care.

The dedicated server seems not to require very much computing power, even with many players (although I had not yet the opportunity to observe the CPU load of a server with many players on it). But I would be surprised if callbacks were delayed or even suppressed by the server.

eyez
Pit Crew
Pit Crew
Posts: 379
Joined: 15 Mar 2006 17:46
Location: Aberdeen, UK

Post by eyez » 30 Jun 2006 14:22

Marck wrote:
Do they generally take a low priority if the server is under a heavy load? Or are the slowdowns most likely to be within the code that is executing them?
Well, without having a look into the Aseco code the only thing I can tell you is that any PHP program which uses GbxRemote.inc.php is expected to poll from a list where callbacks received from a dedicated server are buffered. It depends mainly on the implementation how frequently such polls are performed. Furthermore, PHP is an interpreted scripting language which can be a performance bottleneck if not used with care.

The dedicated server seems not to require very much computing power, even with many players (although I had not yet the opportunity to observe the CPU load of a server with many players on it). But I would be surprised if callbacks were delayed or even suppressed by the server.
Thats for your help. I will have a look at gbxremote to see if I can speed up the polling of callbacks.

I haven't studied the code for your python gbx module yet, but will this use the same process, and if so is it any faster?
I am considering writing a server plugin in python but would only do so if I were to see a noticeable performance gain, especially when retrieving callbacks. I know that python is also a scripting language but have heard it is faster than php, and it would also allow the use of multi-threading which php cannot offer. I wouldnt want to begin a whole new project in python unless I knew there were substantial benefits over php. Any thoughts on this?

Thanks,
eyez

Marck
happy cruiser
happy cruiser
Posts: 113
Joined: 19 Apr 2006 16:24
Location: Germany

Post by Marck » 30 Jun 2006 21:29

eyez wrote:I will have a look at gbxremote to see if I can speed up the polling of callbacks.
I didn't want to imply that the implementation of GbxRemote.inc.php is necessarily the cause of slowdowns. Usually, this depends more on how this include library is used in an application like Aseco.

I don't know how Aseco is actually implemented but if it serializes the processing of callbacks, then all plugins would have to wait for the currently active plugin; only after the plugin has completed its processing of a callback, the next plugin would get its turn to process that callback.

For example, the /add <tmx-id> command of your RASP plugin downloads a track file over the internet and stores it in the dedicated server's Track directory. Such input and output operations (often just referred to as "I/O") are relatively slow compared to mere computing tasks. While the /add command is processed, all other processing in Aseco would have to wait.

Usually, there are two solutions for this issue: asynchronous I/O and multi-threading. I don't know if either is available with PHP or if Aseco is utilizing it. With Python, both solutions are possible. The idea of multi-threading is to relay tasks to dedicated threads which process these tasks (nearly) in parallel, thus allowing to process the next task despite the current one has not yet been completed.

With asynchronous I/O you would, for instance, start the download of a track file but wouldn't wait for its completion. Instead, you would get a notification when the download finishes. (This is very similar to the callback mechanism used by the dedicated server.) In the meantime, other plugins could get their turn.

Having said that, the performance does not so much depend on the tools you use but more on how you use these tools, i.e. how you structure your implementation.
I haven't studied the code for your python gbx module yet, but will this use the same process, and if so is it any faster?
Like GbxRemote.inc.php, my Python module for GBX offers buffering of received callbacks in a list that an application polls (in class Gbx.AlternativeClient). Additionally, you can register handler procedures which are invoked when particular callbacks are received (in class Gbx.Client). Both methods serialize the processing of callbacks, too. Neither method is necessarily superior to the other one, for reasons I tried to explain above. For example, you could implement a dispatching of tasks to dedicated threads using either of these methods.
I am considering writing a server plugin in python but would only do so if I were to see a noticeable performance gain, especially when retrieving callbacks. I know that python is also a scripting language but have heard it is faster than php, and it would also allow the use of multi-threading which php cannot offer. I wouldnt want to begin a whole new project in python unless I knew there were substantial benefits over php. Any thoughts on this?
I have hardly worked with PHP, thus I cannot really assess its performance in comparison to Python. However, these languages were designed with different focuses. As far as I know, PHP was designed to support the development of web-based applications. In contrast, Python was designed from the start as a multi-purpose scripting language which should support rapid application development with prototyping as well as implementing production-level applications. In my humble opinion, Python is better suited for implementing a server plugin than PHP. ;)

In conclusion, I can't give definite answers to your questions. You have to consider the choices and make your own decision based on what suits you best. ;)

eyez
Pit Crew
Pit Crew
Posts: 379
Joined: 15 Mar 2006 17:46
Location: Aberdeen, UK

Post by eyez » 01 Jul 2006 19:58

Thanks for your comments. I think the multi-threading option has swayed my opinion and after a quick read-up of the python syntax I will start work on a server plugin similar to Aseco but written in python. I have checked and it seems PHP doesnt support multi-threading, the nearest thing it has is an exec() func which doesnt work very well. A multi-threaded implementation would certainly be a lot more responsive, especially with the program having to process several requests at once.

Like you suggested, I will probably have a main thread which constantly recieves callbacks and starts a new thread if the recieved callback is relevant to the program. Got a lot to learn before I can do this, and unfortunately from what i've seen, Python's online documentation isnt HALF as good as PHP's. I suppose it's all gonna be out there, just harder to find. Another thing, python isn't as integrated with mysql as PHP but I understand there is a mysql module I can use.

Watch this space.. ;)

eyez
Pit Crew
Pit Crew
Posts: 379
Joined: 15 Mar 2006 17:46
Location: Aberdeen, UK

Post by eyez » 07 Jul 2006 23:52

Dunno if this has been pointed out for not, but theres a spelling mistake in one of the server callbacks. One of the array struct keys for "GetCurrentChallengeInfo" is called "Environnement" as opposed to "Environment". At first I thought it was a type in the listmethods file, but when I tried to use that method I had to use the dodgy spelling. Not gonna loose any sleep over it, but thought i'd point it out nonetheless.

User avatar
utal
speedy pilot
speedy pilot
Posts: 408
Joined: 30 Apr 2006 01:25
Owned TM-games: TMN, TMU, TMO, TMS
Location: Massamá, Portugal
Contact:

GC4

Post by utal » 09 Jul 2006 17:01

on GC4 event the server rules are:

Server Settings:
Use the Team mode with a 7 point limit. Be sure you’re using a good connection when you host a game. See our tutorial in forum if you have any difficulties setting up the game server correctly.


is there a way to configure Dedicated to use alternate mode points? and btw, whats the meaning of alternate points?

tks
utal

Zahl
happy cruiser
happy cruiser
Posts: 114
Joined: 18 Jul 2006 22:37
Owned TM-games: TM, TMU
Location: Germany
Contact:

Post by Zahl » 21 Jul 2006 16:32

Hi,

I have a little problem using the Chat Callback.
The UId is always 255 and login = ???..

Code: Select all

$call[0]: TrackMania.PlayerChat
$call[1]: Array
(
    [0] => 255
    [1] => ???
    [2] => some text
    [3] => 
)
Can anyone tell me why it doesn't fill the fields properly? :(
Using 2006-05-30 on Linux...

Zahl
happy cruiser
happy cruiser
Posts: 114
Joined: 18 Jul 2006 22:37
Owned TM-games: TM, TMU
Location: Germany
Contact:

Post by Zahl » 23 Jul 2006 16:55

Sorry for bumping this so soon, but I can't continue with scripting
as long as it doesn't work, so can anyone confirm if it's working or
not?

Here's a little php test script:

Code: Select all

<?php

header('Content-Type: text/html; charset=utf-8');
require("GbxRemote.inc.php");

$client = new IXR_Client_Gbx;
if (!$client->Init(5000)) die("Connection failed");
echo "<h2>callbacks:</h2><br/>";
if (!$client->query('EnableCallbacks', true)) die("Callback init failed!");
flush();
while (true) {
   $client->readCB(5);
   $calls = $client->getCBResponses();
   if (!empty($calls)) {
      foreach ($calls as $call) {
         if ($call[0] == 'TrackMania.PlayerChat') {
            echo "call: ".$call[0]."<br/><pre>";
            print_r($call[1]);
            echo "</pre><hr>";
         }
      }     
   }
   flush();
}

?>
Would be nice if anyone could run that on his/her server ;)
Ingame Chat should appear in almost-realtime in the
browser with it...
And please tell which version/os you're using, thx :)



EDIT:
Well, changed everything back to polling the server with GetChatLines...

User avatar
Oldbie
smooth traffic navigator
smooth traffic navigator
Posts: 279
Joined: 23 May 2006 22:17
Location: The Netherlands

Post by Oldbie » 04 Aug 2006 13:11

I'm not sure if this belongs in here....just point the way if I'm in completely the wrong topic.

I have two servers running. I use Aseco and Rasp too and I use the latest dedicated server software.
I have two things I would really like to see fixed in the next release:
- I want to play through the internet instead of LAN.
- If that isn't possible please include the login names of the players on my server in their profiles when I'm connected through LAN. I can't even use a decent kick or ban command because I need their logins and it doesn't show....it shows if you're connected through internet but not through LAN as I'm forced to do.

Bit strange that they provide software to run servers but don't make it user friendly. Now I have to manage IP tables to get an internet game to work. I need to switch to other programs to get a login ID of players on MY server!!
I'm really not happy with this!!
Rugby World Cup Champions 1995, 2007: DIE SPRINGBOKKE

User avatar
MCWulf
sunday driver
sunday driver
Posts: 73
Joined: 16 Nov 2005 22:14
Location: Germany
Contact:

Post by MCWulf » 12 Aug 2006 11:41

Hi there,
I've got a big problem! I want to post an user some text on a messagebox with the "SendDisplayServerMessageToLogin"-Command. All right, the most text, I sent, is beeing displayed, for exaple this one:

Code: Select all

$z$s$8dfTracks in set$z$s$fff Pro-Training$z$s$8df:
$z$s$fff1$z$s$8df  -  $z$s$fffPro A-0
$z$s$fff2$z$s$8df  -  $z$s$fffPro A-1
$z$s$fff3$z$s$8df  -  $z$s$fffPro A-2
$z$s$fff4$z$s$8df  -  $z$s$fffPro A-3
$z$s$fff5$z$s$8df  -  $z$s$fffPro A-4
$z$s$fff6$z$s$8df  -  $z$s$fffPro A-5
$z$s$fff7$z$s$8df  -  $z$s$fffPro A-6
$z$s$fff8$z$s$8df  -  $z$s$fffPro A-7
$z$s$fff9$z$s$8df  -  $z$s$fffPro A-8
$z$s$fff10$z$s$8df  -  $z$s$fffPro A-9
Good, but the following one will not be displayed and after sending the message to an user, noone can write down anything into the chat (the callback "TrackMania.PlayerChat" is registered, but no text is displayed)

Code: Select all

$z$s$8dfTracks in set$z$s$fff Gamez-Club$z$s$8df:
$z$s$fff50$z$s$8df  -  $z$s$fff-32-$s$wRuleBritannia
$z$s$fff51$z$s$8df  -  $z$s$fff$00aRiding on a$fc0 Star
$z$s$fff52$z$s$8df  -  $z$s$fff$823Ahead is a $9bcblur
$z$s$fff53$z$s$8df  -  $z$s$fff$930$wBrown $wStains
$z$s$fff54$z$s$8df  -  $z$s$fff$b22$wDragons$n$314Bane
$z$s$fff55$z$s$8df  -  $z$s$fff$f00 _[=_LSD PHANTASIE_=]_
$z$s$fff56$z$s$8df  -  $z$s$fff$fff$i$wBlack Velvet
$z$s$fff57$z$s$8df  -  $z$s$fff$i$090Dutch$090Delight$000_$a00No SC
$z$s$fff58$z$s$8df  -  $z$s$fff$i$f00Heart $fffIn A Cage
$z$s$fff59$z$s$8df  -  $z$s$fff$i$w$f80Race Generation
$z$s$fff60$z$s$8df  -  $z$s$fff$i$w$fffThe $fffFactory
$z$s$fff61$z$s$8df  -  $z$s$fff$iVerticalFrame
$z$s$fff62$z$s$8df  -  $z$s$fff$s$w$300Mo$400vi$500ng $600Po$700w$800er
$z$s$fff63$z$s$8df  -  $z$s$fff$w$ff0Back for $00fNations
$z$s$fff64$z$s$8df  -  $z$s$fff__$s$w$f40 A$f50e$f60r$f70i$f80a$f90l
$z$s$fff65$z$s$8df  -  $z$s$fffFAST AND COOL
$z$s$fff66$z$s$8df  -  $z$s$fffWavelet.Challenge.Gbx
This is really bad, and i tested nearly everything, but i dont know the answer.... The size of the text cant it be, because a text like 500x500 signs will be displayed (but the ok-button is under the screen *g*)

so perhaps you have any idea? Here the code, who displays the message:

Code: Select all

/*------*/if ($cmd['command'] == "/showtracks"){
            if ($cmd['admin'] == "1"){
              $setname = "";
              $abfrage = "SELECT * FROM sets WHERE id = '".$cmd['params'][1]."'";
              $ergebnis = mysql_query($abfrage);
              while($row = mysql_fetch_object($ergebnis))
              {
                $setname = " ".$row->Bezeichnung;
              }
              $msg = $servermessage."Tracks in set".$servermessagehighlight.$setname.$servermessage.":";
              $abfrage = "SELECT * FROM settracks WHERE setid = '".$cmd['params'][1]."'";
              $ergebnis = mysql_query($abfrage);
              while($row = mysql_fetch_object($ergebnis))
              {
                $abfrage2 = "SELECT * FROM tracks WHERE TrackID = '".$row->trackid."'";
                $ergebnis2 = mysql_query($abfrage2);
                while($row2 = mysql_fetch_object($ergebnis2))
                {
                  $msg.="\n  ".$servermessagehighlight.$row2->TrackID.$servermessage."  -  ".$servermessagehighlight.$row2->TrackName;
                }
              }
              console($msg);
              if(!$client->query("SendDisplayServerMessageToLogin", $call[1][1], $msg, "Ok", "", 0)){
        		    Error($client->getErrorMessage(), $client->getErrorCode());
              }
            }
/*------*/}
I really hope you can help me, thanks a lot! :D
MfG
MC Wulf | mofc.de

Board: DFI Lanparty UT NF4 Ultra-D
CPU: AMD Athlon64 X2 3800+
Graphic: NVidia GeForce 7800GTX
RAM: 4x Infinieon DDR2 1GB
OS: WinXP Pro SP1

eyez
Pit Crew
Pit Crew
Posts: 379
Joined: 15 Mar 2006 17:46
Location: Aberdeen, UK

Post by eyez » 12 Aug 2006 13:45

This is a bug with the server which occurs when you send a display message that is too large. Try to keep the maximum lines at around 12-15 and make sure the width doesnt go over 768 pixels (as a guideline).

User avatar
MCWulf
sunday driver
sunday driver
Posts: 73
Joined: 16 Nov 2005 22:14
Location: Germany
Contact:

Post by MCWulf » 12 Aug 2006 13:51

hm, strainge... because i thought on something like this, too, so i tried following messages:
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
worked finde!
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
worked fine....

but y doesnt works it with the text above? T_T
MfG
MC Wulf | mofc.de

Board: DFI Lanparty UT NF4 Ultra-D
CPU: AMD Athlon64 X2 3800+
Graphic: NVidia GeForce 7800GTX
RAM: 4x Infinieon DDR2 1GB
OS: WinXP Pro SP1

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Post by Assembler Maniac » 12 Aug 2006 14:24

MCWulf wrote: Good, but the following one will not be displayed and after sending the message to an user, noone can write down anything into the chat (the callback "TrackMania.PlayerChat" is registered, but no text is displayed)

Code: Select all

$z$s$8dfTracks in set$z$s$fff Gamez-Club$z$s$8df:
$z$s$fff50$z$s$8df  -  $z$s$fff-32-$s$wRuleBritannia
$z$s$fff51$z$s$8df  -  $z$s$fff$00aRiding on a$fc0 Star
$z$s$fff52$z$s$8df  -  $z$s$fff$823Ahead is a $9bcblur
$z$s$fff53$z$s$8df  -  $z$s$fff$930$wBrown $wStains
$z$s$fff54$z$s$8df  -  $z$s$fff$b22$wDragons$n$314Bane
$z$s$fff55$z$s$8df  -  $z$s$fff$f00 _[=_LSD PHANTASIE_=]_
$z$s$fff56$z$s$8df  -  $z$s$fff$fff$i$wBlack Velvet
$z$s$fff57$z$s$8df  -  $z$s$fff$i$090Dutch$090Delight$000_$a00No SC
$z$s$fff58$z$s$8df  -  $z$s$fff$i$f00Heart $fffIn A Cage
$z$s$fff59$z$s$8df  -  $z$s$fff$i$w$f80Race Generation
$z$s$fff60$z$s$8df  -  $z$s$fff$i$w$fffThe $fffFactory
$z$s$fff61$z$s$8df  -  $z$s$fff$iVerticalFrame
$z$s$fff62$z$s$8df  -  $z$s$fff$s$w$300Mo$400vi$500ng $600Po$700w$800er
$z$s$fff63$z$s$8df  -  $z$s$fff$w$ff0Back for $00fNations
$z$s$fff64$z$s$8df  -  $z$s$fff__$s$w$f40 A$f50e$f60r$f70i$f80a$f90l
$z$s$fff65$z$s$8df  -  $z$s$fffFAST AND COOL
$z$s$fff66$z$s$8df  -  $z$s$fffWavelet.Challenge.Gbx
This is really bad, and i tested nearly everything, but i dont know the answer.... The size of the text cant it be, because a text like 500x500 signs will be displayed (but the ok-button is under the screen *g*)

<snip>

I really hope you can help me, thanks a lot! :D
What program are you using as a base for this? If it's ASECO .61b, consider using RASP 0.4.4 with it. It has the feature for listing tracks built in, and will page them out so there's only 10 per page. It will also let you search for a track by name/author. viewtopic.php?t=3356&start=0

As for the actual problem, I suspect it's a combination of the number of lines and the total amount of text, but have no way to be sure.

If you know PHP you can look at include/rasp.funcs.php file in RASP to see how to break up the pages. Functions to look at are getAllChallenges and event_multi_message. The first function builds the pages & displays the first page, the second displays the next page when you click "Next".

User avatar
MCWulf
sunday driver
sunday driver
Posts: 73
Joined: 16 Nov 2005 22:14
Location: Germany
Contact:

Post by MCWulf » 12 Aug 2006 15:10

Well, thank you a lot for your help, i'll test it tomorrow, because i'm going on a party this evening...

I built my own serverscript, so i dont use any scripts which you descriped. but i'll program a splitting-function/multipage/function as you said... thanks!
MfG
MC Wulf | mofc.de

Board: DFI Lanparty UT NF4 Ultra-D
CPU: AMD Athlon64 X2 3800+
Graphic: NVidia GeForce 7800GTX
RAM: 4x Infinieon DDR2 1GB
OS: WinXP Pro SP1

Georgiooo
cyclist
cyclist
Posts: 36
Joined: 28 Apr 2006 03:17
Location: Belgium

Post by Georgiooo » 12 Aug 2006 15:42

Zahl wrote:Sorry for bumping this so soon, but I can't continue with scripting
as long as it doesn't work, so can anyone confirm if it's working or
not?

Here's a little php test script:

Code: Select all

<?php

header('Content-Type: text/html; charset=utf-8');
require("GbxRemote.inc.php");

$client = new IXR_Client_Gbx;
if (!$client->Init(5000)) die("Connection failed");
echo "<h2>callbacks:</h2><br/>";
if (!$client->query('EnableCallbacks', true)) die("Callback init failed!");
flush();
while (true) {
   $client->readCB(5);
   $calls = $client->getCBResponses();
   if (!empty($calls)) {
      foreach ($calls as $call) {
         if ($call[0] == 'TrackMania.PlayerChat') {
            echo "call: ".$call[0]."<br/><pre>";
            print_r($call[1]);
            echo "</pre><hr>";
         }
      }     
   }
   flush();
}

?>
Would be nice if anyone could run that on his/her server ;)
Ingame Chat should appear in almost-realtime in the
browser with it...
And please tell which version/os you're using, thx :)



EDIT:
Well, changed everything back to polling the server with GetChatLines...
It doesn't work with my server

Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 0 is not allowed to access ./GbxRemote.inc.php owned by uid 1006 in /home/trackmania/www/tmn2/chat.php on line 4

Warning: main(GbxRemote.inc.php): failed to open stream: Success in /home/trackmania/www/tmn2/chat.php on line 4

Fatal error: main(): Failed opening required 'GbxRemote.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/trackmania/www/tmn2/chat.php on line 4

Post Reply