Closed Raptor007 closed 3 years ago
This should probably be a cvar since the "buggy" slope behavior has been around since 1.52 (and baseq2).
Looking at the Quake 2 Pmove
function used for client-side movement, I was able to confirm my guess about why this is happening. Here is the order of relevant events:
This means if you are on the ground and step towards a downward slope (no matter how steep or shallow) the first movement frame will not apply any gravity (velocity[2] = 0
). You will move horizontally only, so you won't "bump into" the ground, and you will be marked as "in air" (groundentity = NULL
) at the final position check of the frame. To the server, this change from "on ground" to "in air" starts a jump animation. The next few frames will apply gravity until you land on the ground, and then the cycle repeats. This is why players appear to hop down all slopes.
This behavior is probably desirable on steep hills, but looks silly on very shallow ones.
The ideal fix would have been in 1997 for Quake 2 to apply gravity during movement even when on the ground, but it would no longer be appropriate to change the way Quake 2 feels. However, there are ways for a mod like AQ2 to work around the side-effects of this behavior, such as preventing the hopping animation when walking down small slopes.
I've added the slopefix
cvar, enabled (1) by default. It's not latched, so feel free to toggle this on and off on your server to see the difference. I think this is a massive improvement for walk animations on maps like cliff and teamjungle with sloped terrain.
This issue is caused by Quake 2 client
Pmove
, but shows up mostly in Action Quake maps with sloped ground, like teamjungle and cliff.The problem is that the client sends
pm.groundentity NULL
intermittently as you walk forward down a slight incline, where ideally it would always be the entity you're walking on (world or other): https://github.com/Raptor007/aq2-tng/blob/3835e46b4016a0e7c582c9bad0e831da1171bf55/source/p_client.c#L2995This causes
G_SetClientFrame
to start "jump" animations because it thinks you are leaving the ground: https://github.com/Raptor007/aq2-tng/blob/3835e46b4016a0e7c582c9bad0e831da1171bf55/source/p_view.c#L1056-L1057It also makes the 3rd person spectator look annoying, especially at higher framerates.
UpdateChaseCam
increases the spectator camera height when the player hasgroundentity == NULL
so the camera rapidly jiggles up and down: https://github.com/Raptor007/aq2-tng/blob/3835e46b4016a0e7c582c9bad0e831da1171bf55/source/g_chase.c#L152-L154I think I can work around this. If the
ClientThink
is claiming apm.groundentity NULL
butent->groundentity != NULL
it should do some kind of sanity check to see if it should honor the incoming "in-air" state or keep the previous groundentity... maybe based on how far the height has changed?