You need to make sure the variable "someFutureTime" is in the prediction data descs correctly (even if it's not networked) or else it's intermediate values won't be restored correctly by the prediction system, etc.
It's okay to do your SetAbsVelocity code in player PostThink() since that is called from the gamemovement code during CUserCmd processing. Also, you should consider using SetVelocity instead of SetAbsVelocity (they're the same unless you are attached to something via hierarchy which isn't usually the case for a player). Yahn -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Chang Sent: Sunday, January 18, 2009 5:15 AM To: [email protected] Subject: Re: [hlcoders] SetAbsVelocity prediction problems Expanding on this problem... some pseudocode... Scenario A Player::PostThink(){ if( player attacks ) SetAbsVelocity( moveForward ) } Scenario B Player::PostThink(){ if( player attacks ) someFutureTime = gpGlobals->curtime + 0.5 if( gpGlobals->curtime > someFutureTime ) SetAbsVelocity( moveForward) } The first scenario properly sets the velocity on both client and server. No prediction error occurs. In the second scenario, the client and server seems to be ALWAYS out of sync no matter what. If I put a msg on the second condition right before SetAbsVelocity, gpGlobals->curtime never matches. It seems like they need to in order to fire the velocity together at the same time. What do I do in this situation? ~M On Sun, Jan 18, 2009 at 4:39 PM, Michael Chang <[email protected]>wrote: > Hi all > > Thanks for helping me last time Jorge and Ryan. But I need more help... I > think I've whittled down the problem to its core. > > I'm trying to do a very simple SetAbsVelocity on the player but I'm getting > prediction problems. > > First I tried doing SetAbsVelocity on ItemPreFrame for the player with some > high velocity forwards, whenever the player attacks. > On the client, it seems to push the player quickly, then get corrected by > the server. > On the server, the velocity seems to be over-written later down the path. > > I debugged and traced through everything I can think of. The velocity is > being set properly and not touched thereafter, but on the client is reset > immediately on the next frame somehow. > > Then I tried doing SetAbsVelocity on ItemPostFrame which seems like the > wrong place to put this. Whenever the player attacks, the game pushes the > player forwards. > > With 0 ping this looks great. Everything appears to work. With net_fakelag > 200 you can clearly see the client pushing the player forwards a little > bit... STOPPING... then when the message comes down from the server the > client finally gets teleported to a position further ahead. This is very > choppy, especially for our third-person game. > > > How do we fix this? Are there any clues? Please help. > > ~M > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

