View Full Version : Flipping players

6th Sep 2001, 02:47 AM
This is pretty hard to explain but I wonder if you've seen this as well...

Start up a network game or join a network server. Move up behind a friendly player that is walking forward and bump into him from behind. Just walkin into his back. On large open areas you will sometimes notice that the bumped player pops/flips away a distance (most of the time all the way to the distance wall or whatever is in the way) and back again.

This happens more often in games where you have different playerclasses with different groundspeed, but you can also see it in normal UT CTF.

Seen it? Any idea why it happens?

I've seen it happen lots of times in unrealfortress where you have a large range of different groundspeeds. Trying to backstab someone or infect an enemy can be pretty hard when the enemy flips/pops away like that.

21st Sep 2001, 03:46 AM
It is part of the unrealtournament netcode:

from playerpawn.replicatemove:

ForEach AllActors(class'Pawn', P)
if ( (P != self) && (P.Velocity != vect(0,0,0)) && P.bBlockPlayers )
Dir = Normal(P.Location - Location);
if ( (Velocity Dot Dir > 0) && (P.Velocity Dot Dir > 0) )
// if other pawn moving away from player, push it away if its close
// since the client-side position is behind the server side position
if ( VSize(P.Location - Location) < P.CollisionRadius + CollisionRadius + NewMove.Delta * GroundSpeed )
P.MoveSmooth(P.Velocity * 0.5 * PlayerReplicationInfo.Ping);

Appearently, it doesn't work very well :p
Epic screwed up and forgot to divide ping by 1000 ;p

21st Sep 2001, 04:38 AM
Oh my... thanks, this must be it. Any good way to fix it?

21st Sep 2001, 11:00 PM
in a custom playerpawn (UnF has these already).

22nd Sep 2001, 11:56 AM
Yes, I'm in the UnF team, so I know where to put it, I just wondered if you knew how to fix it up code-wise. But I'll look into that part and see what can be done about it since It annoys me :)

Is it the value of PlayerReplicationInfo.Ping that is too high?

One funny thing... I mailed Tim about this a year ago or so, and this bug/effect came like news to him. He thought we had done something ourselves to the pawn movements. I always thought it was somewhere in the Pawn bump-events...never saw this one ;)

You got the same code in ClientUpdatePosition. I wonder what will happen if this piece of code was commented away. Risk getting stuck inside another player in network games?

Thanks again usaar33, you rock.

22nd Sep 2001, 06:25 PM
simply divide ping by 1000 for a true ping.

It should be noted that Mongo feels, and I now agree with, that the 0.5 should not exist.

However, the code has a fundamental problem: if fixed, you will keep pushing the player in front and thus overrun your pos on the server (and be pushed back with clientupdateposition).

You may want to ensure that the player is only moved when the server updates the location of that player. (yes, it will be very hard to know when this occurs)

27th Sep 2001, 04:10 AM
I just tried this out. I do like this in replicatemove():

P.MoveSmooth(P.Velocity * (PlayerReplicationInfo.Ping/1000));

and tested it on my LAN. Seems to work perfect the few minutes I tried it out, but dividing the ping with that much will result in a close to zero velocity - the bumped player doesn't move at all. *shrugs* Seems to do the trick anyway, it's WAY easier to knife down the enemy now... ;)