[Twisted-Python] how to handle game messaging

Jake b ninmonkeys at gmail.com
Thu May 15 07:57:53 MDT 2008

Hello, I'm new to the list. I've been going through the twisted
tutorials, and now I'm trying to write a simple asteroids clone to
better understand twisted. ( Think asteroids: but 2 players on a LAN )

(1) In a game like this, or even a first person shooter: where message
speed is more important: What is a good way to send messages to/from
the client and server? Important ones like bullet spawning, other
player locations, etc ?

(2) Do you also send a timestamp so that if the client receives the
message 250ms after the spawn, he can step backwards in his physics
simulation to better simulate client-side?

(3) I wrote pseudo-code of how I think the asteroids code messaging
could work. How do I improve messaging? What am I doing wrong? For my
example I'm going to only use LAN ( so I don't have to deal with
latency issues ). I attached the pseudo code.

Here's an overview of the code:

A GameClient() (run once per client) and GameServer() (run once).
There is a list of Bullet()s and a list of Asteroid()s.

When a player fires, he will tell/ask the server. The server will pass
all spawnings onto the clients. I don't think I need to constantly
update the clients with physics updates -- except the locations of the
players. All other updates should be able to be handled on events (
asteroid shot, player collisions, etc... )

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2008.05.08-twisted_game_integration.code.py
Type: text/x-python
Size: 3610 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20080515/97e329a4/attachment-0002.py>

More information about the Twisted-Python mailing list