Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2014, 01:55 PM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:42 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3