After
I am experimenting with in XNA and I am having some problems with 'interval'.
I have downloaded them and have seen that even their samples are also the thing is that the movement is not smooth on the other side, and I try it on the LAN (actually on the same computer) I am not on the internet.
Are there any problems with regard to any problem due to unsmooth movement from a cold connection with lidgren and XNA?
Text after "div class =" itemprop = "text">
Sample You set the link directly to whatever position the network receives, a multiplayer game For a bad idea!
What you should do in the real game, there is a difference between the local situation and the remote situation, so, your received method looks something like this:
get zero ( Packet) {unit.RemoteX = packet.Read_X_Position (); Unit.RemoteY = packet.Read_Y_Position (); } Instead, the entity has no effect on the local position, instead of your updated method (every frame), you move the local position to the remote state:
add zero (deltaTime) {difference = unit.RemoteX-unit.LocalX if (intersection of the & lt; threshold) unit.LocalX = unit.RemoteX rest unit.LocalX + = difference * deltaTime * interpolation_constant } You then display the unit's "local" status, in this way, without any moving movement:
- If the unit position is in near remote condition, then this remote situation (though, it will jump at such a short distance that it will not look long).
- If the difference is too big to jump, then slowly move towards the place whose position you need. The interpolation continues to control how fast the local and remote conditions will be gathered. With continuous zero interpolation, the unit will not notice the network update, with constant 1 it will teleport directly to the network status (and look laggy) - so you need to choose somewhere between a compromise
As it takes the unit easily where it should be, it seems like there is no lag at all!
There are some other things to consider when applying this type of system, for example, you often want an upper limit how far the units can be from their remote location otherwise Local and remote states can be "unstick" in some situations, they are also removing (which should never leave extreme cases of extreme gaps) you either stop the game and the user tells it is too laggy Spun, or jump straight to the unit in the event, which will laggy but continue at least game.
Appendix: Rereading this answer, it is for me that there will be an increase in tracking the time difference, if you know what is the interval (in the system), you know That when you receive packets from a remote location, you know how far is the packet in the past. If you also send remote velocity, you can guess where the object is now (assuming constant velocity) In favor They should be in other games the difference between the local state and true remote state (where you can change the velocity), it may make things worse.
Comments
Post a Comment