Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Lord Maz

How to handle packets

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

Hi, I''m new to network programming and when I tried to implement a multiplayer mode for my project, I got some problems. I can send packets and all that works great, but I''m not sure how to handle the packets and when to send them.. The problem was first when I sent packets every time a object moved, but since the movement happends very often (you move the objects with the mouse) it gets shaky. I tried to remedy this by constraining the number of packets sent, only one packet every t seconds (t is about 0.05), and when recived I move the object gradually from its current position to the new one over the time t. This works pretty well, but I''d prefer a less ugly method that (for example) doesn''t rely on hardcoded timers.. Anyone with experience who can tell me how to do it the best way possible? Thanks for any help! -Lord Maz-

Share this post

Link to post
Share on other sites
... so make the timer configurable

Seriously though, you may be overcomplicating things. The approach of sending on movement, but throttling to a certain rate seems just fine for the time being. Just make sure that the code is structured so that if you do find out that the current method doesn''t scale later, you will be able to change it easily.


Share this post

Link to post
Share on other sites

  • 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!