Game Development Community

Using Torque with a python server

by Ed Colmar · in Technical Issues · 01/25/2006 (5:45 pm) · 6 replies

Greetings!

I am brand new to torque, and look forward to working with it.

My background is a web programmer, mainly in python. I'd like to build my server using python (twisted), and have Torque clients conect to it.

Can anyone point me towards some documentation on the Torque networking layer, specifically how datagrams are formed, and port communication configurations.

I'm digging through the RTS starter kit now to get a feel for it, but I'd appreciate any personal tips.

Cheers!

-e-

About the author

Recent Threads


#2
01/26/2006 (10:06 am)
After looking over the Torque Network Layer it is clear that it is very well thought out, and implemented... Trying to rebuild this functionality in python would be time consuming, and ultimately not worth the effort.

I would be interested in attempting to wrap some of the torque server functionality in python. Any other users out there tried this?

Are there any examples of stand alone server code floating around that I could attempt this with? Still trying to get my head around all this code in the starter kits. (Great work BTW... Glad I found Torque!)

Worst case, I'll just have to bite the bullet and code in C. =(

-e
#3
01/26/2006 (10:12 am)
Well, Minions of Mirth bound python in as a TorqueScript replacement, but I haven't seen any information on basically doing the reverse (tying Torque into Python).

In general, Torque isn't designed as an API, but it a fully integrated simulation engine, so it can be difficult simply to "expose" parts of Torque to an external/standalone app.
#4
01/27/2006 (10:10 pm)
Minions of Mirth uses Torque as a Python extension, which is the same thing as 'tying Torque into Python' ... Josh had released an early version of this as PyTorque, but he isn't supporting it and it's hard to find nowadays. His original TGEPython resource which allows you to embed Python into TGE is available in the GG Resources.

Creating a Python extension out of the TGE codebase is something that's obviously doable, but not neessarily for the faint of heart.

Creating a TNL python extension would likely be fairly straight forward if you're marginally familiar with creating python extensions.
#5
01/27/2006 (11:01 pm)
Minions of Mirth uses Torque as a Python extension. This could be considered "tying Torque into Python". If you are going to spend the bulk of your time with Python and Python libraries, I would recommend this approach. The extension code for MoM is based on TGEPython with enhancements... Unfortunately, I don't have time to package up a code release at this time.

MoM uses both the Twisted networking framework and Torque's built in UDP networking.

I would make darned sure you need all this for your game before using anything but stock Torque. Python is a JOY to code in and has fantastic libraries... though, TorqueScript might be able to get you there and even be a better fit, for your game.

-Josh Ritter
Prairie Games, Inc
#6
01/30/2006 (12:31 pm)
Thanks for the replies Jeremy and Josh!

I'm mainly concerned with geting a python server set up for torque clients to connect to. I'd be really interested in seeing what you're using twisted UDP for, and how you've gone about it. That seems right along the lines of what I'm after.

Probably I will experiment around with the TNL in C until I get a feel for it. I'm still a total newbie to torque.

Thanks again!

-ed