On 5/31/10, Alan Gauld <alan.ga...@btinternet.com> wrote: > > "Alex Hall" <mehg...@gmail.com> wrote > >> I realize that one of us will have to play server and the other >> client, but the roles nake no difference. > > Actually since there are only two players in Battleships you > could dispense with a server and do a peer to peer game. > > Or you could create a single server and both be clients. When you say 'peer to peer', is this still with Python sockets? It sounds like what I am looking for! Or, creating a server and both of us being clients: I have a server (not my own machine, but I rent space on an iPowerWeb.com server) so I could do this, but I would have no idea where to start. Sounds like the p2p connection is the best one. > There are several ways to architect this. > You could even make it a web app with cookies to > record which player is which. I need a lot of keyboard interaction and popup dialogs with lists and input controls, and my server does not have Python on it. Good thought, though; maybe I could strip this one down and port to js... > >> Basically, how might I go about setting up a connection between the >> two computers? Not at the socket level, but how do I tell his game >> that mine is ready to start? How do I decide who is server and who >> is >> client? Thanks! > > If you go for a socket level interaction then you need to > define your own protocol, or message set. There is a basic > example of that in my tutorial in the Network Programming > topic under the AddressBook example. > > If the protocol is significant in size - lots of commands - its > best to define the message strings as constants in a shared > module that both client and server can read. Python's string > formatting characters make a useful templating language. > > HTH, > > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/tutor/ > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
-- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor