Network game using mysql

Tino Wildenhain tino at wildenhain.de
Tue Apr 14 17:14:37 EDT 2009


Hi,

João Abrantes wrote:
> 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..

You could use Postgres instead and write stored functions in python
to access the tables. This would avoid your asynchrous approach
alltogether.

Regards
Tino



More information about the Python-list mailing list