Network game using mysql
kushal.kumaran at gmail.com
Wed Apr 15 09:06:24 CEST 2009
2009/4/15 João Abrantes <jepe_abrantes at hotmail.com>:
> Good evening,
> I am making an online game that stores its data in a mysql database. The
> thing is that I can't allow the players to interact directly with the
> important tables of database (they could cheat if I give them access) so I
> only allow them to write on a table named commands and then a python program
> running on the server will interpreter that command and update the important
> tables. For example, a user that wants to build an house writes on the
> commands table 'build house', and then my python program takes the resources
> of the user and gives him an house. The thing is that I need to have a
> program reading the command list in a infinite while loop and I don't know
> if there is a better way to do this, I am afraid that if the command list
> gets to crowed my python program may not handle all the commands in time.
> And if I put two programs reading the same command list sometimes they
> handle the command twice..
It does seem like you need a queue, with as many readers as required
depending on load. Take a look at pyprocessing. I think it is
included in the standard library as of Python 2.6, with the name
Do the clients connect directly to your database over the network?
More information about the Python-list