You don't need to predict anything for the flinch animation, just set the
sequence as normal on the client.

However, you need to account properly for predicting incorrectly. So when
you set the flinch animation, keep playing it until the server acknowledges
the command that you predicted. (See
IPrediction::GetLastAcknowledgedCommand and
CBasePlayer::CurrentCommandNumber.) At this point, you can check whether
you did actually hit them (has m_iHealth decreased?)

There is a LOT of things to account for, and you need to know your stuff.
I've just implemented predicted attacks and deaths in CSProMod. However I
still have to predict the impulse so I'd be very interested in how to do
this.

On Thursday, March 15, 2012, Michael Chang <flux.black...@gmail.com> wrote:
> Hey guys, this sounds somewhat nonsensical (prediction of non local) but
bear with me.
> I've got attacks that knock other players away, as well as cause the
other players to flinch / pain animation. Now, I'm not aware of how other
Source mods deal with this, but how are things like that normally predicted
(if at all?). I want the effects of hitting another player with the attack
to be visibly instantaneous: knockback (impulse velocity) and stun
animation (simple sequence playback). Currently, lagged players will only
see the effect some time after the attack is finished, which is pretty
unacceptable in our fighting game.
> Tony suggested I predict the other clients (always). I got stuck at
trying to pick and choose what vars for the other clients to predict. For
example, I only want to explicitly predict their absvelocity and write a
dummy gamemovement for their knockback, however their absvelocity is
constantly being predicted at all times and there doesn't appear to be any
way I can control when / what to predict.
> My next experiment is to attempt to InitPredictable() and
ShutdownPredictable() during the time the victim is suffering hit stun.
This lead to a curious case where after doing Init and Shutdown predictable
a few times (twice, exactly?), the non local player stops becoming
traceable via Util_Trace functions on client-side. One can probably test
this by setting ShouldPredict to return true for players, calling
InitPredictable on any weapon impact, calling ShutdownPredictable some time
after, then doing a DevMsg on the impact on client -- the trace seemingly
stops working.
> Is there some better way to get around this?
> Can I summon Yahn's professional opinion on this?
> ~M

-- 


Kind regards,
*Saul Rennison*
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Reply via email to