Game Development Community

Torque Master Server in Python

by Andy Rollins · in Torque Game Engine · 04/22/2008 (10:55 am) · 8 replies

I'm sure I'd seen a resource or forum for a master server written in Python but can't for the life of me find it, the searches I've done have found the perl version by Thomas Lund, Ben Garneys pushbutton version in C and a built in one to the engine.

Am I going mad here or does anyone know of a Python version? If not I'll code it and release as a resource.

Ta, Andy

#1
04/22/2008 (11:31 am)
Not that I know of. It seems like there was one in Perl and one in PHP. As well as a couple of C++ ones that I don't think had any of the source released. There is a basic setup in TNL that I've used as an example in the past for people. But I don't remember seeing one in Python.
#2
04/22/2008 (11:41 am)
Are you thinking of TGEPython? That was a resource Josh Ritter made years ago when he started messing with plugging Python into Torque. I don't think it had any master server stuff in it though.
#3
04/22/2008 (11:58 am)
I've never seen that resource, but the Determinance master server is written in Python and works very well.

Ian
#5
04/22/2008 (5:35 pm)
Thanks for the replies guys, I knew about tgepython so it isn't that, must just be my memory failing me with all the resources and details to take in on here. Heh it'll give me the chance to learn python and I'll release it as a resource in case anyone else could use or suggest improvements.

Thanks
#6
04/25/2008 (10:25 am)
I didn't think that TGEPython included a Master Server.
#7
04/26/2008 (4:19 am)
David - indeed TGEPython doesn't include a master server.

Currently on day 3 of learning Python and have a working master server up and running with it, the heartbeats come through great and are held in memory. When the client requests the lists of servers, I've processed the request and have most of the values worked out correctly.... the bit I'm a little stuck on at the moment is the response packets back to the client I have most parts correct but the port number is proving troublesome as it's a 2 byte element, I appear to have fudged around it by doing the following as chr() only takes a single byte but I've no idea if this is the correct approach?

port = 28000
    n, b = divmod(port, 256)
    n, b1 = divmod(n, 256)
    porty = chr(b) + chr(b1)

If any Python or network people could comment/advise that would be great.

Once I have the basic server finished and done I'll post the code on here
#8
04/28/2008 (2:16 pm)
Problem solved and I've posted the finished server coded in Python as a resource here. Thanks for the responses everyone.