473,739 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Network Game in Python

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

Aug 1 '06 #1
1 1762
di********@gmai l.com wrote:
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.

--
Ben Sizer

Aug 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2718
by: Moosebumps | last post by:
When I have time, I am planning to evaluate Python for console game development (on Playstation 2, GameCube, and Xbox). Does anyone have any experience with this? Pretty much the only resource I have found, and the only thing that makes me think it might be possible is this: http://asbahr.com/python.html I would be interested to hear anybody's experience with Python on consoles.
3
1929
by: Michael Rybak | last post by:
Hi, everyone. In topic "2-player game, client and server at localhost", I've asked about subj, and Peter Hansen suggested to switch to Twisted, Pyro or the like. I've tried using Pyro. I've written a very very simple test-game, in which you have 2 balls controlled by 2 players. Each player moves his mouse somewhere at his window, and his ball starts moving towards the pointer. No
0
2177
by: Michael Goettsche | last post by:
Hi there, for a project in our computer science lessons at school we decided to write a client/server based battleship like game . I know this game could be written without a server, but the whole project is for educational purposes. Being the initiator of this project, I thought I would write a skeleton for it before we actually start with it. The client thing won't be too hard, what I'm having problems with is the server, maybe...
1
1592
by: Andreas R. | last post by:
Hello, I'm using Python's asynchat module for network support in a Python-based game, and I run into two problems, both of which occur at random times. Most of the time, the network sending and receiving is perfect, but about 1 out of 10 times, it fails with one of these errors: -- Problem 1. When sending data, I sometimes the following exception: Handler connected 127.0.0.1:1242 at 0x2977800> (socket.error:(9, 'Bad file descriptor')
1
3694
by: Jerry Fleming | last post by:
Hi, I have wrote a game with python curses. The problem is that I want to confirm before quitting, while my implementation doesn't seem to work. Anyone can help me? #!/usr/bin/python # # Brick & Ball in Python # by Jerry Fleming <jerryfleming@etang.com>
0
1039
by: Richard Szlachta | last post by:
Readers of python mailing list of all ages and systems, I'd like to introduce you program called ' Piskworky '. It is written in python, uses tkinter gui and is made for playing game known as five-in-row. Game is pure multiplayer (two-player exactly ;) and it does it's synchronization via jabber network. Well, check the website: http://piskworky.ic.cz/
0
1837
by: Jeff Rush | last post by:
At PyCon this year we're going to have a multi-day game programming clinic and challenge. This is a first-time event and an experiment to find those in the Python community who enjoy playing and creating games. Python has several powerful modules for the creation of games among which are PyGame and PyOpenGL. On Friday evening, Phil Hassey will give an introduction to his game Galcon, an awesome high-paced multi-player galactic...
1
1790
by: Andrew | last post by:
Hello Everyone I am receiving an error in an application I am working on. The application when its done will be a Dungeons and Dragons Network game. I am having problems with the Networked Canvas basically for drawing the dungeon maps If I initialize two of the Tkinter Canvas widgets with in the same window I can draw across the network, however if I open a second instance of the Application and initialize the canvas, on windows I recv
10
2017
by: Michael Lubker | last post by:
Any people that use Python as the predominant language for their game development here? ~Michael
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.