- We have a server of self.server_class and we have the game IO loop,
- a thread running self.loop. Both communicate with each other via a
- queue.Queue. While the server may spawn parallel threads to many
- clients, the IO loop works sequentially through game commands
- received from the server's client connections. A processed command
- may trigger messages to the commanding client or to all clients,
- delivered from the IO loop to the server via the queue.
+ The game loop works sequentially through game commands received
+ via self.queue from connected servers' clients."""
+ self.queue = queue.Queue()
+ c = threading.Thread(target=self.loop, args=(self.queue,))
+ c.start()
+
+ def start_server(self, port, server_class):
+ """Start server of server_class in talk with game loop.