View Single Post
  #26  
Old 10-03-2008, 05:56 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I would almost certainly say to set the variables on zone bootup. Seems to be the obvious choice. Anything that reduces the number of database hits is good, and setting that at zone bootup shouldn't cause any performance differences at all.

But, even though KLS says the 800 is hard coded, I can say that just by looking at what the MQ map shows, it seems pretty clear that the code I posted above is the code used for sending position updates. Within a range of 50ish, the movements on the map are almost perfectly smooth (.3 second timer), then from 50 to about 250, they are slightly less smooth (.6 second timer), and from 250 to 500 even slightly less smooth (.9 second timer), And anything from 500 to 800 is kinda choppy (2 second timer), and after that it uses the zonewide update setting, which by default is 1 minute, but if you set the rule it can be much higher.

So, I am not completely convinced that the 800 setting KLS mentioned is what is being used all of the time.

Here is the code that I think is handling those updates:

mob.cpp
Code:
void Mob::SendPosUpdate(int8 iSendToSelf) {
	EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
	PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
	MakeSpawnUpdate(spu);
	if (iSendToSelf == 2) {
		if (this->IsClient())
			this->CastToClient()->FastQueuePacket(&app,false);
	}
	else
#ifdef PACKET_UPDATE_MANAGER
		entity_list.QueueManaged(this, app, (iSendToSelf==0),false);
#else
		entity_list.QueueCloseClients(this, app, (iSendToSelf==0), 800, NULL, false);
#endif
	safe_delete(app);
}
entity.cpp
Code:
void EntityList::QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, bool ackreq) {
	LinkedListIterator<Client*> iterator(client_list);
	
#ifdef PACKET_UPDATE_MANAGER
	EQApplicationPacket* tmp_app = app->Copy();
#endif
	
	iterator.Reset();
	while(iterator.MoreElements())
	{
		Client* ent = iterator.GetData();

		if ((!ignore_sender || ent != sender))
		{
#ifdef PACKET_UPDATE_MANAGER
			ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
#else
			ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
#endif
		}
		iterator.Advance();
	}
#ifdef PACKET_UPDATE_MANAGER
	EQApplicationPacket::PacketUsed(&tmp_app);
#endif
}


void EntityList::QueueClientsStatus(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, int8 minstatus, int8 maxstatus)
{
	LinkedListIterator<Client*> iterator(client_list);
	
	iterator.Reset();
	while(iterator.MoreElements())
	{
		if ((!ignore_sender || iterator.GetData() != sender) && (iterator.GetData()->Admin() >= minstatus && iterator.GetData()->Admin() <= maxstatus))
		{
			iterator.GetData()->QueuePacket(app);
		}
		iterator.Advance();
	}	
}
updatemgr.cpp
Code:
void UpdateManager::QueuePacket(EQApplicationPacket *app, bool ack_req, Mob *from, float range2) {
	int r = UPDATE_LEVELS;
	UMMap *cur = levels;
	const float *cur_d = level_distances2;
	cur += UPDATE_LEVELS;	//move to the end.
	cur_d += UPDATE_LEVELS - 1;
	//work backwards since mobs are more likely to be further away
	for(r = UPDATE_LEVELS; r >= 0; r--, cur--, cur_d--) {
		if(range2 < *cur_d)
			continue;
		//this packet falls into this queue...
		uint32 id = MakeUpdateID(from, app);
//		if(r < 2)
//			net->QueuePacket(app, ack_req);
//LogFile->write(EQEMuLog::Debug, "Queueing packet from %s (0x%.4x) id=0x%x at level %d\n", from->GetName(), app->GetOpcode(), id, r);
		app->PacketReferenced();
		//reference decrementing is taken care of my UMType destructor
		//if anything is overwritten
		(*cur)[id] = UMType(app, ack_req);
//		(*cur)[id] = UMType(app->Copy(), ack_req);
		return;
	}
	//if we get here, were in trouble...
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote