Turn-based game - experimental economics
Paolo Crosetto
paolo.crosetto at unimi.it
Fri Sep 11 12:44:41 EDT 2009
In data sabato 05 settembre 2009 21:47:41, Dennis Lee Bieber ha scritto:
> Much better to just send the token TO the active client (which is
> responsible for returning it at the end of its turn processing)
Dennis,
I am finally getting my head round this problem. I do have a further question,
though.
I am using XMLRPC as server. It is quite convenient since it handles all low-
level network stuff for me. On the other hand, though, it seems I cannot make
the server actually _send_ anything to the clients; it just sits there and
waits for calls.
This is rather inconvenient for me, as every time I need to send the clients
some information (eg, the state of the game) I have to formulate the problem
as a specific call from each client. This can indeed be done quite easily, but
the end result is a staggering amount of calls to the server, and high cpu
usage - this might as well slow down the network in the lab, I guess.
If you look at the pseudocode you sent me - and I implemented - you see, on
the clients side, where the -->**** are, that a call to update is made over
and over again.
-=-=-=-=-=- "Display"
connect to "game"
ACTIVE = False
while True:
get game data ---> *****
update console display ---> *****
ACTIVE = game data == active token
if ACTIVE:
get user input
if user input == EndTurn:
ACTIVE = False
send user input
if user input == QUIT:
break
disconnect from "game"
Is there any way of telling XMLRPC 'send this and this to all clients
connected'?
Or should I use another server-side technology? I have no much experience in
writing network programs - this is my first - and I'd rather not go into
complicated stuff.
Thanks!
--
Paolo Crosetto
---------------------------------------------------------------------
PhD Student in Economics
DEAS - Department of Economics - University of Milan
---------------------------------------------------------------------
More information about the Python-list
mailing list