Jump to content
  • Advertisement
Sign in to follow this  
Sir Sapo

Client Extrapolation

This topic is 4867 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright , I have 2 questions for you guys. 1. When I call a recv() in winsock using TCP protcol, will the program wait there until it recieves something, or does it just keep going if it doesn't recieve anything. 2. I'm trying to have my networked games server send data only about 5 times a second, and have the client extrapolate where everyone will be until it recieves new data. Right now, the game runs at 5 FPS, I think because it sits there and waits for the data. In order to fix this, should I send a little bit of info everytime the server updates, that says whether to wait for data, or update autonomously from the server? Here's some psuedo-code for what I'm trying to explain:
//Server Code

if(updatetime)
{
send(timetoupdate);
send(allthedata);
}

if(!updatetime)
{
send(nottimetoupdate);
}


//Client Code

recv(doIupdate);

if(doIupdate)
{
recv(allthedata);
}

if(!doIupdate)
{
Extrapolatestuff();
}


Can anyone clarify this for me?

Share this post


Link to post
Share on other sites
Advertisement
Function calls for socket I/O can be either blocking or non-blocking. It sounds like you're current source codes uses blocking sockets. In Winsock, to make the calls non-blocking you can use ioctlsocket() with the FIONBIO command to make a socket non-blocking. Also calls to WSAAsyncSelect() or WSAEventSelect() should also make a socket non-blocking.

Share this post


Link to post
Share on other sites
Typically, you'll check for readable sockets using select(). When a TCP socket is returned as readable, it will return whatever data is available (without blocking) the first time you call recv() after that. An alternative is to make the socket non-blocking. The Forum FAQ has pointers to more information.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!