Jump to content
  • Advertisement
Sign in to follow this  
Weng

Sending player position packets to client computers

This topic is 3203 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

I am working on a point and click 3D multi-player LAN game where there are 4 players in the game. For updating the position of a player character on other computers, I plan to just send the destination position of the mouse click to other computers so that the same character on other computers will perform its own translation calculations to get to that point. To make sure that the character on other computers are generally on the right track, the server will send periodic updates to other computers so that they can check and correct the movements if necessary. Is this method sufficient for its purpose? And generally, how frequent should the periodic updates be sent? (e.g. every 12-15 frames?) Currently, what I do now is to send the position directly to other computers every 5 frames regardless of whether the player is moving or not. The other computers will just translate the player character to the position received. It is simpler but I think it is the reason why the game's frame rate drops when 4 players are playing together.

Share this post


Link to post
Share on other sites
Advertisement
It sounds sufficient. The rate at which you need to send the updates is proportional to the speed at which units move. As an extreme example, if a unit moves at a rate of 1 pixel per minute, then even 1 update per 10 seconds is more than you need. In theory it's also proportional to the amount of jitter in your network connection and to how often a unit may change direction but I think that's overkill for your purposes. My guess is that 5 times per moving unit per second will be enough if units typically follow straight-line paths.

PS. Consider the cheating implications of sending destination clicks to opponent players.

Share this post


Link to post
Share on other sites
wouldn't you want to send a packet every time the player moves to a differnt x,y,z pos? Or would you want to send a packet everytime they stop moving an then send a map update also.

Share this post


Link to post
Share on other sites
If you're doing floating-point simulation, then the player is at a new x,y,z pos each frame.

However, given that your frame rate will vary on different machines, I would suggest setting a send rate. For example, each machine could send an update 5 times per second (every 200 milliseconds). That way, network usage is predictable, and doesn't vary with frame rate.

Share this post


Link to post
Share on other sites
I also do the same as mentioned above. Although I send even less frequently (1 second intervals) as it doesn't worry me too much if things dont look identical on each PC as, generally, the users would never know the difference.

It all depends on how you want your program to operate.

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!