View Single Post
  #40  
Old 10-13-2008, 07:53 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Thanks for looking into this, KLS! I do know for sure that even just by changing the globalpositionupdate rule from 60 seconds to 10 minutes makes a huge difference on raid lag. With enough tweaking to the system to make it as efficient as possible, I think we could remove a large chunk of unneeded bandwidth usage. I wouldn't even be surprised if we could double the amount of players that a server could handle.

So, if we disabled the globalpositionupdate, do you think we would need to essentially add it to the update manager levels? Currently, there are 4 levels that can be set in the update manager. Could there be a 5th level that is just equal to anything greater than the 4th level to encompass the rest of the zone? Then maybe have an update timer for that level similar to how the global position updates work now, but adjustable per zone. I think that would take care of possible mob ghosting issues.

You mention that position updates are currently only sent if an NPC moves. That may be true for the update manager, but I think the globalpositionupdate is currently just sending the entire zone's NPC positions whether they moved or not. I think that is why non-moving NPCs seem to jump every minute, but I may be wrong about that. If it was only sending updates for NPCs that had moved, I don't think adjusting the timer setting rule would have made nearly as much impact as what I have seen from it.

I have been looking through the code for this alot lately. I know my code understanding is still noob at best, but from what I can tell, the globalpositionupdate is sending every npc's position whether they moved or not.

Code:
		//60 seconds, or whatever the rule is set to has passed, send this position to everyone to avoid ghosting
		if(global_position_update_timer.Check()){
			SendAllPosition();
		}
Code:
void Mob::SendAllPosition() {
	EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
	PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;	
	MakeSpawnUpdateNoDelta(spu);
//?	spu->heading *= 8;
	entity_list.QueueClients(this, app, true);
	safe_delete(app);
}
Code:
void EntityList::QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, bool ackreq) {
	LinkedListIterator<Client*> iterator(client_list);
	
	iterator.Reset();
	while(iterator.MoreElements())
	{
		Client* ent = iterator.GetData();

		if ((!ignore_sender || ent != sender))
		{
			ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
		}
		iterator.Advance();
	}
}
Code:
void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
	memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct));
	spu->spawn_id	= GetID();
	spu->x_pos		= FloatToEQ19(x_pos);
	spu->y_pos		= FloatToEQ19(y_pos);
	spu->z_pos		= FloatToEQ19(z_pos);
	spu->delta_x	= NewFloatToEQ13(0);
	spu->delta_y	= NewFloatToEQ13(0);
	spu->delta_z	= NewFloatToEQ13(0);
	spu->heading	= FloatToEQ19(heading);
	spu->animation	= 0;
	spu->delta_heading = NewFloatToEQ13(0);
	spu->padding0002	=0;
	spu->padding0006	=7;
	spu->padding0014	=0x7f;
	spu->padding0018	=0x5df27;
}
I am not trying to second guess you, btw. I just want to understand what is happening to see how/where it can possibly be tweaked to work better.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote