Network Game in Python

D

diffuser78

I have to create a small and simple GUI app in Python which is similar
to a netwrok game. Let me expalain you. I need some suggestions. I
might use wxPython for GUI because that is the only GUI oolkit I know.

There are 6 players in the game. They are all connected though a LAN
(possible an internal network). There is one main supervirsor who
starts the game and other 5 are players.

Once the supervisor starts the game, a move goes randomly to any player
out of the 5 players. Once a player gets a move he has to act. Based on
his action next move will be generated by supervisor and sent to some
other player in the network. This process goes on untill the simulation
time ends. Winners and Loosers are decided by some point system which
supervisor keeps track of.

Some questions I have are:
1. How can I manage network messages among the players. Should
multicast be used or Actor should send the message to Supervisor and he
sends to all. ? What python modules can be handy in these things.

2. How can I manage moves among players. What move a player makes is
visible to all others in real time, so essentially all players have the
same consistent view of the game. Only the person with access can
actually make a move or carry out action. Any suggestion how to carry
out this thing.

3. Shold I use a flat file or some database in mySQL to measure points
etc ? I want to have a repository which keep tracks of all the mvoes in
the system and who played what move etc..? Any suggestions on this.

4. If you have any other input, it will be greatly appreciated.

Thanks
 
B

Ben Sizer

Some questions I have are:
1. How can I manage network messages among the players. Should
multicast be used or Actor should send the message to Supervisor and he
sends to all. ?

Send a message from one client to the supervisor, handle it, then get
the supervisor to send messages back out to notify all clients of the
change. That way, the supervisor always has the correct state, and
knows which clients are aware of it.
What python modules can be handy in these things.

The socket and select modules are all that you need. Perhaps there's a
higher-level solution somewhere but I don't expect you'd need it.
2. How can I manage moves among players. What move a player makes is
visible to all others in real time, so essentially all players have the
same consistent view of the game. Only the person with access can
actually make a move or carry out action. Any suggestion how to carry
out this thing.

As above: inform the supervisor/server of the move, and the server
informs all others of what is going on. Usually this is just a message
telling the client to update certain values. The client will update
those values and refresh the display. You may find it easiest to send
whole objects using pickle or something like that.
3. Shold I use a flat file or some database in mySQL to measure points
etc ? I want to have a repository which keep tracks of all the mvoes in
the system and who played what move etc..? Any suggestions on this.

Use whichever is easiest for you. Why do you need to save the data to
disk anyway? If you definitely need to do that, the shelve module is
often a good choice for basic needs. But it depends on what you need to
do with the information after you write it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,334
Latest member
66Zeinab9

Latest Threads

Top