17
Sep
Python Chat and Game Server
So yeah, all right..yeah, so, alrite. I have taken the first steps to on-line-gaming! Code wise that is. I've blogged about simple echo servers, chat servers and web servers the last couple of weeks and all those things came together in the past project.

I've looked at a couple of frameworks and modules for Python recently. Most notably: PyGame (more on that in an other blog), Twisted and PyGTK+ (a standard Python library nowadays). They turned out to be handier than I'd expected and I based my whole project around them.

PyGTK is a common library for Graphical User Interfaces (GUI's) in python. You can use it when you want a little bit more than a command line program that just blurts out some text now and again. PyGTK isn't very flexible to work with, but once you got everything where it should be it is quite all right.

I used Twisted for the network connections and I can't say anything else then that it was great! No longer have you got to deal with low-level thread programming and hoping that everything will execute normally: Twisted does it for you and calls you when it's done. It also integrates perfectly with PyGTK so your window won't freeze. The only thing you have to bother with is the protocol, but that doesn't mean that you haven't got any control over the connections, no sir! Twisted can give you both very high level and very low level control, so everything is posible and everything is possible quickly.

I used the latter two libraries/frameworks to write a stable chat and game server with a GUI and extensive logging capabilities. The chat part is completely functional, but the game part needs a lot of work (the exact information on the game is still a secret).



You can run the server and telnet to it for now because I haven't got a client ready yet. Also, you should have Twisted and PyGTK installed.

Download Source
Python Chat and Game server coding page

Edit @ Sep 20, 2007: Added a buggy client to the coding pages (now that's a nice sell!) so you know it's currently under development.Click here to see the client



3 Comments


1
RE: Python Chat and Game Server
Written by: Lars Hammarstrom
2008-05-04 23:06:17
Finaly I found what I have been looking for for so long time, a telnet game in Python. I have a great Idea for making someting realy cool for an MMORPG that is online in heawy GFX. This could be a good way to get the "lowlevel hardware" users to have a chanse to experience the game in a smaler package :) I'm looking forward to the development, keep up the good work. Best regards, Lars Hammarstrom

2
RE: Python Chat and Game Server
Written by: David Salinas Cortés
2009-11-11 14:11:30
Hi, i have found your code and i think i want to borrow some lines for a project.

What's the license for your code?

Thanks!


3
RE: Python Chat and Game Server
Written by: Bart site
2009-11-11 21:16:25
Hi David, the code is currently licensed under the GPLv3, but let me know what your needs are in that regards because maybe we can work something out. btw You can find an updated version which has rsa encryption, channels and some more features on my github page http://github.com/bspaans/pylanchat


Leave a comment
Name*
E-mail
Website
Title*
Comment*
Notify me when somebody else comments on this article