Hi Droid,
Until now I only knew about two possibilities to network a game: using
the python sockets or twisted. Both are kinda complicated to use (at
least seem to me, although I haven't used one of them).
Twisted really looks complicated, but you can treat most of it as
magic. Its tough to find a good entrance-point with twisted - their
docs definitly are not, although they are elaborate. I learned twisted
like that:
After reading this pygame tutorial
http://sjbrown.ezide.com/games/writing-games.html I knew, that the
part of twisted I want to use is called "perspective broker" - a PB is
a very easy way (2-5 lines of code) to make your python classes
remotly callable. The code in the tutorial seems out of date - newer
twisted had some name changes, but the principal is the same. The
tutorial helps you to see, how you can integrate those twisted calls
with pygame.
So, after reading the tutorial, you should take a look at the howtos
under caption "perspective broker" on this page:
http://twistedmatrix.com/projects/core/documentation/howto/
<http://twistedmatrix.com/projects/core/documentation/howto/>
I've written two classes - one for the server, one for the client -
that take care of the networking in my pygame projects - if you're
interested I can upload them. Though your game has to be
event-based... basically how it works is this: some events get a
special flag, that tells the network controller "i must send this
event to the client/server".
pyraknet seems to be very easy and straight forward to use, although I
haven't used it yet.
Haven't heared of that before... it uses (reliable) udp, whereas
twisted PB uses tcp.
My question is: does someone know pyraknet and/or has some experience
with it?
hm.. what I like about twisted: I hacked together those very basic
network classes, and it works flawlessly... once I might find myself
in the position where I need to improve the network-code (security,
performance..) and thats possible to do with twisted.
greetings
simon