Client uses a single thread with it's own socket to send inputs to the server
Server uses a single thread with a blocking socket to receive the inputs
No need to worry about NAT because the server isn't sending any data to the client
This will be efficient because the server will only use CPU when it receives data and the client
Game state updates are communicated this way:
Client uses one non-blocking socket and two threads.
One for sending NAT punches and another to recieve game state updates. They share a lock on the socket.
Server uses one socket and two threads.
One for receiving NAT and another for sending state. They share a lock on the socket.
Since we're sharing the socket we can't have it set to blocking when reading because then send would never get a hold of it.
With this change, the server runs at < 10% CPU with 10 bot clients using the strategy 0.
Description
With this change, the server runs at < 10% CPU with 10 bot clients using the strategy 0.
Fixes
Fixes #166