[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] online game?



Python has a low-level implementation of sockets natively. The specification and several examples can be found at:

http://docs.python.org/library/socket.html


On Tue, May 18, 2010 at 23:26, Alex Hall <mehgcap@xxxxxxxxx> wrote:
Hi all,
Before I continue into the strange world of pretty graphics, I want to
check that Pygame can support some sort of online multi-player
implementation. I expect no more than two players at a time. Is it
possible to have two computers running the same game, both online,
connected to each other, and have that game reacting to something the
other player is doing? Here is an example. p1 and p2 are both players,
connected over the internet. p1 is hosting (still not sure how that
will work). The game is Battleship.
p1: fires a shell at grid square b2, which is a square holding one of
p2's ships. On p1's side, the square at b2 turns red and they are told
they scored a hit. The game then locks them out of doing anything, and
p2 is told it is their turn.
p2: when p1 fires, p2 is told that their battleship was hit at b2, and
some status info is updated. The lock is removed as soon as it is p2's
turn, and p2 fires at d5, which is a miss. P2's d5 square turns white,
and they are then locked out of the game as the turn switches to p1.
p1: is informed that p2 missed, and then fires a shell...

Is this possible? If so, how (as in where do I want to look)? If not,
is there another library, maybe even one that would tie into pygame,
that would let me do this? Thanks!

--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap