New answers tagged client-server
0
Note that your current solution will likely start both timers within 1 second of eachother, probably even within a few hundred milliseconds. Getting this more accurate is a difficult problem to solve with certainty, but you can get it "close enough" for games, although it's still not easy. I would also note that timing mechanisms on two different machines ...
0
I don't know what platform you are using but you should find out if you have access to a time function that returns the number of seconds since January 1st 1970.
IE:http://www.cplusplus.com/reference/ctime/time/
With that, you send your start time to the clients who can then figure out total elapsed time.
Otherwise you'll have to do some fancy math to ...
2
Is this right?
Sounds good to me.
then correct the world state if somebody did something after I received the next packet.
The simple approach is to remove the "if" here--always update everything from the server. The important state is the transform and linear and angular velocities for each box2d dynamic rigid body. You would update all these ...
0
From my experience it's never a good idea to wait on the server to send out the world update packets before the next world update. I'd day that it'd be best if you put a copy of the whole box2d world for each client and act as if each of the other clients have the same keys pressed down, but try and send the packets to the client to update the other client's ...
Top 50 recent answers are included
