Monster movement: U_NOLERP aka U_STEP
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
Monster movement: U_NOLERP aka U_STEP
Even with animation/transform interpolation on, if you want to see some real jerky monster movement, connect a client like JoeQuake to quake.thisserversucks.com:26003 (RQuake) or fvf.servequake.com.
Because monsters get the U_NOLERP flag (LordHavoc refers to U_NOLERP as U_STEP ... since U_NOLERP was only used for monsters) their movement is not interpolated as it is with players.
In fact, you don't even need to be connected to one of those coop servers to see the problem. I could record a demo of such.
Now, if you connect to either of those servers with DarkPlaces, the monster movement is smooth as silk.
What DarkPlaces does is slightly special treatment of monster movement and he has a nice formula to calculate whether or not to interpolate the movement during a frame.
I haven't been able to implement it yet, but I did a 90%/10% fix that fully interpolates the movement if cls.state == ca_connected + sv_active == false (connected to a server) and doesn't fully interpolate the movement if (single player).
I'm not sure how well the above works in a super-low ping "connected to a server" situation like a LAN. At least not yet. Which is why I need to implement the DarkPlaces fix.
If you fully interpolate the movement in a single player by not honoring the U_NOLERP flag at all, grunts move around in a silly looking manner that doesn't look like they are taking steps.
Because monsters get the U_NOLERP flag (LordHavoc refers to U_NOLERP as U_STEP ... since U_NOLERP was only used for monsters) their movement is not interpolated as it is with players.
In fact, you don't even need to be connected to one of those coop servers to see the problem. I could record a demo of such.
Now, if you connect to either of those servers with DarkPlaces, the monster movement is smooth as silk.
What DarkPlaces does is slightly special treatment of monster movement and he has a nice formula to calculate whether or not to interpolate the movement during a frame.
I haven't been able to implement it yet, but I did a 90%/10% fix that fully interpolates the movement if cls.state == ca_connected + sv_active == false (connected to a server) and doesn't fully interpolate the movement if (single player).
I'm not sure how well the above works in a super-low ping "connected to a server" situation like a LAN. At least not yet. Which is why I need to implement the DarkPlaces fix.
If you fully interpolate the movement in a single player by not honoring the U_NOLERP flag at all, grunts move around in a silly looking manner that doesn't look like they are taking steps.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
On the other hand, the Quake engine does lerping in a different way during demo playback, so monster interpolation will look jerky during demos unless we compensate for that:
See the "hack" part.
By the way, looking at this again, I could probably optimize that.
- Code: Select all
void CL_RelinkEntities (void)
{
(...)
if (ent->forcelink)
{ // the entity was not updated in the last message
// so move to the final spot
VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->angles);
}
else
{ // if the delta is large, assume a teleport and don't lerp
f = frac;
for (j=0 ; j<3 ; j++)
{
delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j];
if (delta[j] > 100 || delta[j] < -100)
f = 1; // assume a teleportation, not a motion
}
(...)
// interpolate the origin and angles
for (j=0 ; j<3 ; j++)
{
ent->origin[j] = ent->msg_origins[1][j] + f*delta[j];
d = ent->msg_angles[0][j] - ent->msg_angles[1][j];
if (d > 180)
d -= 360;
else if (d < -180)
d += 360;
ent->angles[j] = ent->msg_angles[1][j] + f*d;
}
}
(...)
// Manoel Kasimier - model interpolation - begin
// hack to make interpolation look better in demos
if (cls.demoplayback)
if (i != cl.viewentity && ent!=&cl.viewent && ent->model->type == mod_alias)
{
// if (ent->translate_start_time)
VectorCopy (ent->msg_origins[0], ent->origin);
// if (ent->rotate_start_time)
VectorCopy (ent->msg_angles[0], ent->angles);
}
// Manoel Kasimier - model interpolation - end
if (i == cl.viewentity && !chase_active.value)
continue;
if ( ent->effects & EF_NODRAW )
continue;
if (cl_numvisedicts < MAX_VISEDICTS)
{
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
}
}
}
See the "hack" part.
By the way, looking at this again, I could probably optimize that.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
or you could interpolate it on the server where you know the exact times it had a think, and when it next will, remove the U_STEP flag, and let the client use its normal motion interpolation instead of miss-guessing step interpolation. Just a thought.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
I think I have a demo available that should be jerky in GLQuake.
I'll play the demo in DarkPlaces to see if it is smooth.
If it isn't smooth, Spike's server side suggestion might be the only "true" way.
But if I recall, DarkPlaces tests the movement distance and I bet it'll be smooth in DP.
I'll play the demo in DarkPlaces to see if it is smooth.
If it isn't smooth, Spike's server side suggestion might be the only "true" way.
But if I recall, DarkPlaces tests the movement distance and I bet it'll be smooth in DP.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
DarkPlaces plays the demo fine. And the U_NOSTEP code in DP doesn't distinguish between connection states or anything, it is just a pure formula.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Spike wrote:or you could interpolate it on the server where you know the exact times it had a think, and when it next will, remove the U_STEP flag, and let the client use its normal motion interpolation instead of miss-guessing step interpolation. Just a thought.
But of course, this means a client without interpolation will see monsters ice skating around.
- metlslime
- Posts: 316
- Joined: Tue Feb 05, 2008 11:03 pm
I remember LH saying - with a very early build of DP - that he had done server-side interpolation. I wonder if this was (at least a part of) what he was referring to?
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest