Master Server Prototype Available
by Thomas \"Man of Ice\" Lund · in Torque Game Engine · 02/19/2003 (4:00 am) · 23 replies
As a proof of concept I've coded a very very simple master server prototype in Perl. If anyone is interested, then I'm giving it away to the community with no license restrictions or anything.
The code actually works - basic - but works. You can connect to it using a client and get a list of running servers. No filtering or anything is implemented, and I would only use this code as a starting point.
The source is available at http://www.trylleskoven.dk/c3/c3masterserver.zip
You need to alter your local preference file in fps\client\prefs.cs. Look for the line that is setting the master server. Dump in the address and port for your master server and thats it.
I will not develop further on this code, but start porting it to C++ for our game C3 (www.c3command.com), so dont expect any updates unless there are obvious errors.
Hope this is useful for someone out there
/Thomas
The code actually works - basic - but works. You can connect to it using a client and get a list of running servers. No filtering or anything is implemented, and I would only use this code as a starting point.
The source is available at http://www.trylleskoven.dk/c3/c3masterserver.zip
You need to alter your local preference file in fps\client\prefs.cs. Look for the line that is setting the master server. Dump in the address and port for your master server and thats it.
I will not develop further on this code, but start porting it to C++ for our game C3 (www.c3command.com), so dont expect any updates unless there are obvious errors.
Hope this is useful for someone out there
/Thomas
#2
Perl is what I used to build my GG Master Server Monitor at www.gnometech.com so it stands to reason that a Master Server itself would be doable. Good job!
- LightWave Dave
02/19/2003 (7:21 am)
Greetings!Perl is what I used to build my GG Master Server Monitor at www.gnometech.com so it stands to reason that a Master Server itself would be doable. Good job!
- LightWave Dave
#3
02/19/2003 (7:44 am)
True, true... very fitting :)
#4
Perl is fantastic to do small prototypes in absolutely no time. I spend approx 8 hours from never having seens the Torque engine net code to having the master server done.
Now onto porting it to C++........lol
02/19/2003 (8:02 am)
Yes - Davids monitor and my master server actually can go hand in hand. The monitor is a scaled down game client querying master servers, and my server can provide data to the monitor.Perl is fantastic to do small prototypes in absolutely no time. I spend approx 8 hours from never having seens the Torque engine net code to having the master server done.
Now onto porting it to C++........lol
#6
03/09/2003 (7:06 pm)
Very nice...
#7
Some wierd behavior with the server not sending the list to the client, but this is pretty simple logic, should start seeing dozens of clones soon :)
03/10/2003 (5:13 am)
Whew, gotta love perl.Some wierd behavior with the server not sending the list to the client, but this is pretty simple logic, should start seeing dozens of clones soon :)
#8
Record whenever you recieve a heartbeat from a game server, and then weed out the ones that are dead for more than e.g. 15 mins.
All filtering isnt enabled either, but trivial to add.
I can tell you that porting it to C++ is a hell of a lot harder than writing those 30 lines in Perl - go figure
03/10/2003 (11:36 am)
What you need to add to make this a "fully" running master server is basically only a cleanup routine to weed out dead game servers.Record whenever you recieve a heartbeat from a game server, and then weed out the ones that are dead for more than e.g. 15 mins.
All filtering isnt enabled either, but trivial to add.
I can tell you that porting it to C++ is a hell of a lot harder than writing those 30 lines in Perl - go figure
#9
Wierd thing, the perl in that script accepts heartbeats, and client requests, but isn't sending the lists back to the clients, alsomst as if the index isn't getting populated.
I almost got it to send the lsit back, but most of the time it claims it is sending part 0 of 1. Tried it in a vaariety of network configurations too. Not asking for debug help, I am sure I will figure it out, and it certainly is a great prototype/spec, shows all the things you need to do for a mster server, just observing it might not work out of the box for everyone :)
03/10/2003 (11:42 am)
I'm looking at maybe doing it in Java.Wierd thing, the perl in that script accepts heartbeats, and client requests, but isn't sending the lists back to the clients, alsomst as if the index isn't getting populated.
I almost got it to send the lsit back, but most of the time it claims it is sending part 0 of 1. Tried it in a vaariety of network configurations too. Not asking for debug help, I am sure I will figure it out, and it certainly is a great prototype/spec, shows all the things you need to do for a mster server, just observing it might not work out of the box for everyone :)
#10
03/10/2003 (11:57 am)
The server works fine, you'll have to comment out the key checking and filtering in serverQuery.cc. That's about it, haven't had any problems with it.
#11
Maybe that was it, I'll have a look at that tonight :)
Are those routines obvious?
03/10/2003 (2:39 pm)
Oh really?Maybe that was it, I'll have a look at that tonight :)
Are those routines obvious?
#13
03/10/2003 (4:41 pm)
this is really cool, thank you for contributing.
#14
Let me just check that the code in the zip is the latest version (brb)
/me slaps myself
OK - in the Perl code change the following line:
[thomas@home tmp]$ diff c3masterserver.pl /home/thomas/c3masterserver.pl
83c83
< my $key = $packetkey + 1;
---
> my $key = $packetkey;
So drop the +1
Sorry for that - I'll update the code in the zip file.With this fix there is no need to modify your serverQuery.cc file
03/11/2003 (1:25 am)
Hmmm - the code has run for me with no problem - serving lists back on requests. We have used it (and are still using it) for c3command game servers.Let me just check that the code in the zip is the latest version (brb)
/me slaps myself
OK - in the Perl code change the following line:
[thomas@home tmp]$ diff c3masterserver.pl /home/thomas/c3masterserver.pl
83c83
< my $key = $packetkey + 1;
---
> my $key = $packetkey;
So drop the +1
Sorry for that - I'll update the code in the zip file.With this fix there is no need to modify your serverQuery.cc file
#15
Anyway, thanks again, helluva nice way to share a design idea.
03/11/2003 (5:29 am)
Hehe, hey, it did MOST of what you said it would ;)Anyway, thanks again, helluva nice way to share a design idea.
#16
Almost as bad as forgetting to attach something in an email :-)
03/11/2003 (7:31 am)
One of those classics where you forget to update the zip file with the latest code.Almost as bad as forgetting to attach something in an email :-)
#17
03/11/2003 (7:53 am)
Awesome! Works like a charm!
#18
05/23/2005 (4:00 pm)
This is soo cool! i'm a perl head and had a lot of fun with this one running on my webserver. I do have intermitent Master server errors but mostly it works. I'm very curious about where i can add more messages being sent to my perl besides just 22 and 6. Namely i'd love for the perl to read when a player dies for example. If anyone has any tips about where i should start looking to add this feature please let me know. I'm not sure if it is a change i need to make to the C++ engine code or if i can do it with torqueScript. I've looked for both but still haven't found anything. I will update this if i do though incase it helps anyone. This is a great trick! Thanks for posting. Long live torque!
#19
You have to start in game\net\serverQuery.cc + .h - thats the interface class for the master server.
You could quite easily add a new message + a ConsoleFunction to send a message to the master server triggered from your scripts.
05/24/2005 (7:49 am)
@JamesYou have to start in game\net\serverQuery.cc + .h - thats the interface class for the master server.
You could quite easily add a new message + a ConsoleFunction to send a message to the master server triggered from your scripts.
#20
Seems like something has changed in 1.4. Has anyone been able to use this successfully in 1.4?
01/27/2006 (10:45 am)
I am using torque 1.4. I get the heartbeat fine, then when i load a client and query master server i get nothing on the client. GUI says No Master Servers Found.Seems like something has changed in 1.4. Has anyone been able to use this successfully in 1.4?
Associate Kyle Carter