Ok, I fixed it.
Completely related to client position updates.
Two issues.
The main one (heading was updated BEFORE it is checked to see if it differs below, hence, it always differs.. because the check below does NOT use EQ19toFloat() and compares the converted value to the one passed in).
Inside Client::Handle_OP_ClientUpdate
Code:
@@ -1268,7 +1269,6 @@
delta_y = ppu->delta_y;
delta_z = ppu->delta_z;
delta_heading = ppu->delta_heading;
- heading = EQ19toFloat(ppu->heading);
if(IsTracking() && ((x_pos!=ppu->x_pos) || (y_pos!=ppu->y_pos))){
if(MakeRandomFloat(0, 100) < 70)//should be good
Then below that, same function: (I check the old vs the new, both using the converted values). Previous to this change, every call to this function was sending an update. It always thougth heading was diff from new heading.
It also looks like there is no z comparision? Maybe with my changes the Z component could be added? Might fix some z related issues?
I also added code to use a better float compare. I don't know that its needed, but in general I've foudn that checking for differences smaller than the machine's EPSILON is best. as some FPPs can have rounding errors. I put them both in together and it works. I think they both had impact. The heading was causing every single update to get pushed, even with no change in location. The fact that the bug only happens on uneven ground makes me believe that the rounding issue with floats caused the problem as well.
I use this macro for that:
#define FCMP(a,b) (fabs(a - b) < FLT_EPSILON)
Code:
// Outgoing client packet
- if (ppu->y_pos != y_pos || ppu->x_pos != x_pos || ppu->heading != heading || ppu->animation != animation)
+ float tmpheading=EQ19toFloat(ppu->heading);
+ if (!FCMP(ppu->y_pos,y_pos) || !FCMP(ppu->x_pos,x_pos) || !FCMP(tmpheading,heading) || ppu->animation != animation)
{
x_pos = ppu->x_pos;
y_pos = ppu->y_pos;
z_pos = ppu->z_pos;
animation = ppu->animation;
-
+ heading = tmpheading;
+
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer;
MakeSpawnUpdate(ppu);
The # of updates for a character not moving goes from 1 per second to zero.