Yet Another Master Server Resource - YESMASTER
by Guimo · 07/14/2011 (7:02 am) · 5 comments
You can find it here.
http://www.garagegames.com/community/resources/view/21124
And also here
http://www.garagegames.com/community/resources/view/21125
Its the same post, the GG server had a breakdown while I was posting this so there is a duplicate entry. Sorry for that. Please GG remove one.
This implementation uses Java sockets, mutithreaded resource syncronization, a simple protocol, Torque TCPObject and a lot of love.
Lots of places to expand and improve to your taste. If you are smart enough, you can use this approach to provide extra functions to Torque. I used this approach for a bridge to let my servers read SSL pages using HTTPS.
Luck!
http://www.garagegames.com/community/resources/view/21124
And also here
http://www.garagegames.com/community/resources/view/21125
Its the same post, the GG server had a breakdown while I was posting this so there is a duplicate entry. Sorry for that. Please GG remove one.
This implementation uses Java sockets, mutithreaded resource syncronization, a simple protocol, Torque TCPObject and a lot of love.
Lots of places to expand and improve to your taste. If you are smart enough, you can use this approach to provide extra functions to Torque. I used this approach for a bridge to let my servers read SSL pages using HTTPS.
Luck!
#2
I understand what you say. But not all the games are shooters (which I think is the default implementation in the engine) and I feel there are advantages in doing it this way.
This method will allow for any Torque based engine, including TGB, iTGB or others, to connect to this master server.
Also, the default method relies on a Torque server running, and as I mentioned, a running Torque session requires a high demand on resources unless you throttle the server down. I did run 2 servers in the same computer once and had about 80% CPU usage. I applied a sleep for 1ms during each cycle of the main engine loop to make the engine slowdown and use about 1% or 2% of the CPU requirements, but this approach is not appropriate for 3D shooters but good enough for lots of other games.
This method relies on the Java network architecture which sleeps by default so almost no resources are required at all.
Anyway, this article is supposed as a case study, illustrate basic concepts, example interaction of Torque with Java and TCPObject. I never intended it as a complete MasterServer replacement or definitely MasterServer guide.
Luck!
07/14/2011 (3:03 pm)
Hi Andy,I understand what you say. But not all the games are shooters (which I think is the default implementation in the engine) and I feel there are advantages in doing it this way.
This method will allow for any Torque based engine, including TGB, iTGB or others, to connect to this master server.
Also, the default method relies on a Torque server running, and as I mentioned, a running Torque session requires a high demand on resources unless you throttle the server down. I did run 2 servers in the same computer once and had about 80% CPU usage. I applied a sleep for 1ms during each cycle of the main engine loop to make the engine slowdown and use about 1% or 2% of the CPU requirements, but this approach is not appropriate for 3D shooters but good enough for lots of other games.
This method relies on the Java network architecture which sleeps by default so almost no resources are required at all.
Anyway, this article is supposed as a case study, illustrate basic concepts, example interaction of Torque with Java and TCPObject. I never intended it as a complete MasterServer replacement or definitely MasterServer guide.
Luck!
#3
Also the built in stuff works for ANY game type, its used by thinktanks, works with AFX for RPGS, anything really.
Just think it's best to steer people towards using things already built into the engine than try and replace it, would be great if the java example worked with the standard approach then it would be useable for any Torque game out of the box.
07/14/2011 (3:43 pm)
Guimo - The default method doesn't rely on Torque server running, you can use any language there are example resources for master servers written in perl, php and python. I wrote the python one and you'll find some explanation in that resource of the different packet types and standard process flow. Also the built in stuff works for ANY game type, its used by thinktanks, works with AFX for RPGS, anything really.
Just think it's best to steer people towards using things already built into the engine than try and replace it, would be great if the java example worked with the standard approach then it would be useable for any Torque game out of the box.
#4
I have never really digged into the default implementation of Torque and its master server functionality. Maybe because never I really needed to (my master server implementation for my game is way more complex) or I find this way more under my way of doing things. I always thought it really required some Torque server running as the main server. If not then my bad.
Anyway, I think all this functionality is default only in T3D/TGE and not available in the other engines. If it is then again, my bad.
I just tried to answer to cries of help I find here and there and illustrate the use of Java combined with Torque. To anyone who thinks it is a bad or misleading solution then I'm sorry.
Luck!
07/14/2011 (4:53 pm)
Hi Andy,I have never really digged into the default implementation of Torque and its master server functionality. Maybe because never I really needed to (my master server implementation for my game is way more complex) or I find this way more under my way of doing things. I always thought it really required some Torque server running as the main server. If not then my bad.
Anyway, I think all this functionality is default only in T3D/TGE and not available in the other engines. If it is then again, my bad.
I just tried to answer to cries of help I find here and there and illustrate the use of Java combined with Torque. To anyone who thinks it is a bad or misleading solution then I'm sorry.
Luck!
#5
07/15/2011 (1:27 am)
@Guimo and Andy: I think, it is a good idea to implement a self-written masterserver because every game is unique. In my case, i wrote my masterserver with php/mysql. And i also used multithreading to keep a smooth gameplay during the heartbeat. 
Torque Owner Andy Rollins
ZDay Game
Personall I think it would be best to tie into using those features rather than replacing them with a different one.