On Thu, Apr 25, 2013 at 6:59 AM, <webmas...@terradon.nl> wrote: > hi, > I struggle for some days about a "model" for a multiplayer game application. > I read so much from my enemy Google, i got lost by all that info and dont > know which path i should chose. > > a multiplayer game application, sending/receiving instantly every change in > the game to a central webserver, http://www.xxxxx.com, probably via socket > connection? > > which system/module should i use for this contineous connection and where can > i find a good tutorial, which a beginner like me can understand a bit? (i > have read too many too complicated/technical artickles, but no nice > tutorials). > > i have tried and accompished an urllib connection, with get and post > variabels, but that will be polling, with all the http-overhead for every > poll. I think this is also to slow and no "real" updating of the game status. > > Thanks in advance for any hint/tutorial i get:)
The easiest way to start would be a MUD or chat server. Establish a TCP socket, then whenever anything happens, report the change to all connected sockets. In its simplest form: * Accept connection * Wait for login (or, for a simple test, just "Enter your name: " would do) * Add connection to pool * Whenever a line of text is received, prepend the name and send it to every connection in the pool. That's a basic chat server. A MUD adds only a small bit of complication: you need some form of command parser, and not everything will announce to all connected clients. I can walk you through a lot of this, but I haven't done most of it in Python; there's another language, very similar in semantics, which is better suited to MUD building: Pike. But it's all similar enough that you'll be able to do it in either. The project you're looking at sounds to me like it'd be well implemented as a MUD-style connection with a fancy client in front of it. Debug your system using the MUD connection, and make sure you don't have any security holes that can be exploited by someone switching out your client for a custom one; because, believe you me, someone will figure out how to do it. (If you're concerned about privacy, you can easily switch in SSL/TLS, while not fundamentally changing any of your code.) Start with something as simple as you possibly can, and then add complication only as you find you need it. Here's the module you'll be wanting: http://docs.python.org/3.3/library/socket.html (By the way, you won't be connecting to a *web* server. Your central server will be quite separate from that system. It might happen to be the same computer, but there's no real connection.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list