Sunday, May 17, 2009

server connection

So, there is some progress.

I have forked the development to consist of a client and server version of the base code. The two will evolve separately now.

Currently, the only thing working is that the server supports a single client connection. This client connection sends the ship's positional and orientational (X,Y,Z,H,P,R) data to the server. The server display is then updated to reflect the new values. Biggest problem? My server computer framerate dropped from 60 fps to 5 fps by doing this.

I think the problem is that the current code does not launch a separate thread for communication, so all comms are done in the main thread. The sockets are supposed to be non-blocking, but I think it will come back up when I start threading and passing data through a queue. I currently check the socket for data after each frame render, and parse the string if it is there.

Going forward, I think I will (obviously) thread each comm channel separately, and do a back and forth communication. Ie: the client talks, then waits for the server, then talks, then waits. This back and forth will need some short-ish timeouts set so it doesn't hang, but by doing the exchange this way in a unique thread, the rendering engine should be able to run full speed again.

Yay!

No comments:

Post a Comment