Changed SendZoneSpawnsBulk to a more like-like behavior

This commit is contained in:
Uleat 2016-08-02 17:49:08 -04:00
parent e862994716
commit 7c9bd80c1e
2 changed files with 33 additions and 2 deletions

View File

@ -1,5 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 08/02/2016 ==
Uleat: Changed 'SendZoneSpawnsBulk' behavior to use near/far criteria (live-like) when sending packets.
- Zone-to-Zone client loading will see a small decrease in time (less than 10~15%)
- World-to-Zone client loading appears to greatly benefit from this (tested 'devastation' - pre-change: ~22 seconds, post-change: 12~15 seconds)
- This change does not affect the final spawning of mobs in the client
== 07/31/2016 ==
mackal: Implement more spell gems!
- There are a few things still left to due like make dealing with losing gems nice (reset AAs, going to an older client etc)

View File

@ -1228,7 +1228,9 @@ void EntityList::SendZoneSpawnsBulk(Client *client)
maxspawns = mob_list.size();
auto bzsp = new BulkZoneSpawnPacket(client, maxspawns);
int32 race=-1;
bool delaypkt = false;
const glm::vec4& cpos = client->GetPosition();
const float dmax = 600.0 * 600.0;
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
spawn = it->second;
if (spawn && spawn->GetID() > 0 && spawn->Spawned()) {
@ -1236,8 +1238,30 @@ void EntityList::SendZoneSpawnsBulk(Client *client)
spawn->CastToClient()->IsHoveringForRespawn()))
continue;
race = spawn->GetRace();
#if 1
const glm::vec4& spos = spawn->GetPosition();
delaypkt = false;
if (DistanceSquared(cpos, spos) > dmax || (spawn->IsClient() && (spawn->GetRace() == MINOR_ILL_OBJ || spawn->GetRace() == TREE)))
delaypkt = true;
if (delaypkt) {
app = new EQApplicationPacket;
spawn->CreateSpawnPacket(app);
client->QueuePacket(app, true, Client::CLIENT_CONNECTED);
safe_delete(app);
}
else {
memset(&ns, 0, sizeof(NewSpawn_Struct));
spawn->FillSpawnStruct(&ns, client);
bzsp->AddSpawn(&ns);
}
spawn->SendArmorAppearance(client);
#else
/* original code kept for spawn packet research */
int32 race = spawn->GetRace();
// Illusion races on PCs don't work as a mass spawn
// But they will work as an add_spawn AFTER CLIENT_CONNECTED.
if (spawn->IsClient() && (race == MINOR_ILL_OBJ || race == TREE)) {
@ -1255,6 +1279,7 @@ void EntityList::SendZoneSpawnsBulk(Client *client)
// Despite being sent in the OP_ZoneSpawns packet, the client
// does not display worn armor correctly so display it.
spawn->SendArmorAppearance(client);
#endif
}
}
safe_delete(bzsp);