- Home /
Reducing lag in networking.
Hello
In my application I have a couple of objects that need to be synced at all time. When the object reaches higher velocity it starts lagging. I thought about a system that would predict the objects motions, but there would be too many things to predict. I have a couple of objects that aren't that demanding, but this one needs to be updated at all time. Is there any way to reduce the lag of objects like these, without any unreliable prediction system?
Thanks in advance.
can you describe the lag in more detail? What is the lag? Lag nowadays is used for too many things...
Answer by Professor Snake · Mar 09, 2013 at 11:34 PM
Instead of predicting the objects' movement, you could try a simple interpolation technique instead. For instance, let's assume you have a cube whose transform values are networked, and are updated once every second. This is an extreme state in which there is a lot of sudden movement from the cube, due to the slow update rate. In order to make the movement look smooth, you could have a clientside cube object that is drawn instead of the actual cube object, whose position is always smoothly lerped to the actual cube's position. Think of the actual cube as a waypoint, and of the clientside cube as a little AI that always follows the waypoint. The advantage of this method are that it's pretty simple and easy to implement. However, the clientside object will always be a bit behind the actual object, an effect that is more visible as lag increases.