Archived

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

Lord Maz

How to handle packets

Recommended Posts

Lord Maz    110
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
Prefect    373
... 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.

cu,
Prefect

Share this post


Link to post
Share on other sites