Inside3D!
     

Monster movement: U_NOLERP aka U_STEP

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Jul 17, 2010 10:55 am    Post subject: Monster movement: U_NOLERP aka U_STEP Reply with quote

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.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
mk



Joined: 04 Jul 2008
Posts: 94

PostPosted: Sat Jul 17, 2010 5:19 pm    Post subject: Reply with quote

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:

Code:
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.
_________________
Makaqu engine blog / website.

Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sat Jul 17, 2010 5:50 pm    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Jul 17, 2010 6:58 pm    Post subject: Reply with quote

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.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Jul 17, 2010 8:08 pm    Post subject: Reply with quote

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.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Sat Jul 17, 2010 11:25 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Sat Jul 17, 2010 11:55 pm    Post subject: Reply with quote

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?
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group