views:

440

answers:

3

I'm trying to implement a fairly simple card game in Python so that two players can play together other the Internet. I have no problem with doing the GUI, but I don't know the first thing about how to do the networking part. A couple libraries I've found so far:

  • PyRO: seems nice and seems to fit the problem nicely by having shared Card objects in various states.

  • Twisted with pyglet-twisted: this looks powerful but complicated; I've used Pyglet before though so maybe it wouldn't be too bad.

Can anyone recommend the most appropriate one for my game (not necessarily on this list, I've probably missed lots of good ones)?

+5  A: 

Both of those libraries are very good and would work perfectly for your card game.

Pyro might be easier to learn and use, but Twisted will scale better if you ever want to move into a very large number of players.

Twisted can be daunting at first but there are some books to help you get over the hump.

The are some other libraries to choose from but the two you found are mature and used widely within the Python community so you'll have a better chance of finding people to answer any questions.

My personal recommendation would be to use Pyro if you're just wanting to play around with networking but go with Twisted if you have grand plans for lots of players on the internet.

Van Gale
+2  A: 

If you decide you don't want to use a 3rd party library, I'd recommend the asynchat module in the standard library. It's perfect for sending/receiving through a simple protocol.

Evan Fosmark
+1  A: 

Twisted is the better of the two libraries but the time spent learning to use it but learning networking will take you similar amount of time (at least for me).

If I were you I'd rather learn networking it will be much more useful to you in the future. The concepts are the same for most languages so its more portable as well. If you are going to take this approach have a look at http://www.amk.ca/python/howto/sockets/ it will take you through everything.

MyGfIsAwesome