Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Algorithms > Client predicti...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 589 of 670
Post > Topic >>

Client prediction for remote objects

by "Brandon" <brandony@[EMAIL PROTECTED] > Oct 24, 2006 at 11:51 AM

I'm writing a little 2D overhead multiplayer space shooter.  I use
client-side prediction to make movement smooth for the local player,
and it looks great.  For the local player.  My problem is that I want
to show the player the current location of the other spaceships in
regards to the local player, and to do that I need to predict them,
too.  Now, fortunately, the movements of the enemy spaceships are
pretty smooth, since they smoothly accelerate rather than zip left and
right instantly.

My problem, though, is turning.  When a player presses left or right,
his ship immediatley begins to rotate at a set rotational velocity, and
when the player releases the key, the ship immediately stops turning.
This, again, works great for the local player.  However, when the local
player receives notice that another player began rotating 5 game states
ago, the local player predicts the motion ahead a bit and continues to
extrapolate how the other ship is rotating.  With a bit of smoothing,
that looks fine, too.

The problem is that when the other ship stops turning, the local
machine has already predicted it turning a bit further, which it then
needs to take back, causing it to snap back after finishing a turn like
it's on a spring.  It happens every time, and if there's 500ms of lag
or so, it can be more than a 180 degree turn.

In order to solve this problem, I've tried a few techniques.  The
first, obviously, was to stop the prediction of turning.  I still use
the predicted turn angle to compute motion (if you're accelerating), so
if you have quite a bit of lag, you might notice the ship not quite
flying in the right direction briefly on occasion, but it's hardly
noticeable.  I haven't quite worked out a good way to smooth between
these messages yet, especially in a situation with high variance in the
network connection's lag, but I'm sure I can work out something that
more or less works.

So, I'm asking for general input as to how to handle players controlled
elsewhere in a system that uses client prediction.  In half-life 2, for
instance, I do not notice the other players take a step back every time
they stop walking forwards.  Does half-life 2 not predict the locations
of other players?  Or does it use some other, neater trick?




 4 Posts in Topic:
Client prediction for remote objects
"Brandon" <b  2006-10-24 11:51:24 
Re: Client prediction for remote objects
"Gabriel Belingueres  2006-10-25 06:37:05 
Re: Client prediction for remote objects
"Lizerd" <1@  2006-10-26 14:34:40 
Re: Client prediction for remote objects
"m0rdred" <i  2006-10-27 14:59:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 5:33:32 CDT 2008.