mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 11:31:30 +00:00
Adjust ghosting algorithm to work much better for super large zones as well
This commit is contained in:
parent
a6af014d5e
commit
d9eeb00dea
@ -4498,7 +4498,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
float distance_moved = DistanceNoZ(GetLastPositionBeforeBulkUpdate(), GetPosition());
|
float distance_moved = DistanceNoZ(GetLastPositionBeforeBulkUpdate(), GetPosition());
|
||||||
bool moved_far_enough_before_bulk_update = distance_moved >= 1200;
|
bool moved_far_enough_before_bulk_update = distance_moved >= zone->GetNpcPositionUpdateDistance();
|
||||||
bool is_ready_to_update = (
|
bool is_ready_to_update = (
|
||||||
client_zone_wide_full_position_update_timer.Check() || moved_far_enough_before_bulk_update
|
client_zone_wide_full_position_update_timer.Check() || moved_far_enough_before_bulk_update
|
||||||
);
|
);
|
||||||
@ -4515,8 +4515,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float distance_from_client_to_ignore = zone->GetMaxMovementUpdateRange() - 100;
|
float distance_from_client_to_ignore = zone->GetNpcPositionUpdateDistance();
|
||||||
if (CalculateDistance(entity->GetX(), entity->GetY(), entity->GetZ()) <= distance_from_client_to_ignore) {
|
if (entity->IsMoving() && CalculateDistance(entity->GetX(), entity->GetY(), entity->GetZ()) <= distance_from_client_to_ignore) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -762,7 +762,7 @@ void MobMovementManager::SendCommandToClients(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float short_range = RuleR(Pathing, ShortMovementUpdateRange);
|
float short_range = RuleR(Pathing, ShortMovementUpdateRange);
|
||||||
float long_range = zone->GetMaxMovementUpdateRange();
|
float long_range = zone->GetNpcPositionUpdateDistance();
|
||||||
|
|
||||||
for (auto &c : _impl->Clients) {
|
for (auto &c : _impl->Clients) {
|
||||||
if (single_client && c != single_client) {
|
if (single_client && c != single_client) {
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
#include "zone_config.h"
|
#include "zone_config.h"
|
||||||
#include "mob_movement_manager.h"
|
#include "mob_movement_manager.h"
|
||||||
#include "npc_scale_manager.h"
|
#include "npc_scale_manager.h"
|
||||||
|
#include "../common/data_verification.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@ -864,6 +865,8 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
|||||||
m_last_ucss_update = 0;
|
m_last_ucss_update = 0;
|
||||||
|
|
||||||
mMovementManager = &MobMovementManager::Get();
|
mMovementManager = &MobMovementManager::Get();
|
||||||
|
|
||||||
|
SetNpcPositionUpdateDistance(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone::~Zone() {
|
Zone::~Zone() {
|
||||||
@ -1194,9 +1197,9 @@ uint32 Zone::CountAuth() {
|
|||||||
bool Zone::Process() {
|
bool Zone::Process() {
|
||||||
spawn_conditions.Process();
|
spawn_conditions.Process();
|
||||||
|
|
||||||
if(spawn2_timer.Check()) {
|
if (spawn2_timer.Check()) {
|
||||||
|
|
||||||
LinkedListIterator<Spawn2*> iterator(spawn2_list);
|
LinkedListIterator<Spawn2 *> iterator(spawn2_list);
|
||||||
|
|
||||||
EQEmu::InventoryProfile::CleanDirty();
|
EQEmu::InventoryProfile::CleanDirty();
|
||||||
|
|
||||||
@ -1212,10 +1215,15 @@ bool Zone::Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(adv_data && !did_adventure_actions)
|
if (adv_data && !did_adventure_actions) {
|
||||||
DoAdventureActions();
|
DoAdventureActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetNpcPositionUpdateDistance() == 0) {
|
||||||
|
CalculateNpcUpdateDistanceSpread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(initgrids_timer.Check()) {
|
if(initgrids_timer.Check()) {
|
||||||
//delayed grid loading stuff.
|
//delayed grid loading stuff.
|
||||||
initgrids_timer.Disable();
|
initgrids_timer.Disable();
|
||||||
@ -2365,3 +2373,59 @@ void Zone::SetUCSServerAvailable(bool ucss_available, uint32 update_timestamp) {
|
|||||||
if (m_last_ucss_update < update_timestamp)
|
if (m_last_ucss_update < update_timestamp)
|
||||||
m_ucss_available = ucss_available;
|
m_ucss_available = ucss_available;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Zone::GetNpcPositionUpdateDistance() const
|
||||||
|
{
|
||||||
|
return npc_position_update_distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::SetNpcPositionUpdateDistance(int in_npc_position_update_distance)
|
||||||
|
{
|
||||||
|
Zone::npc_position_update_distance = in_npc_position_update_distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::CalculateNpcUpdateDistanceSpread()
|
||||||
|
{
|
||||||
|
float max_x = 0;
|
||||||
|
float max_y = 0;
|
||||||
|
float min_x = 0;
|
||||||
|
float min_y = 0;
|
||||||
|
|
||||||
|
auto &mob_list = entity_list.GetMobList();
|
||||||
|
|
||||||
|
for (auto &it : mob_list) {
|
||||||
|
Mob *entity = it.second;
|
||||||
|
if (!entity->IsNPC()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity->GetX() <= min_x) {
|
||||||
|
min_x = entity->GetX();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity->GetY() <= min_y) {
|
||||||
|
min_y = entity->GetY();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity->GetX() >= max_x) {
|
||||||
|
max_x = entity->GetX();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity->GetY() >= max_y) {
|
||||||
|
max_y = entity->GetY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int x_spread = int(abs(max_x - min_x));
|
||||||
|
int y_spread = int(abs(max_y - min_y));
|
||||||
|
int combined_spread = int(abs((x_spread + y_spread) / 2));
|
||||||
|
int update_distance = EQEmu::ClampLower(int(combined_spread / 4), int(zone->GetMaxMovementUpdateRange()));
|
||||||
|
|
||||||
|
SetNpcPositionUpdateDistance(update_distance);
|
||||||
|
|
||||||
|
Log(Logs::General, Logs::Debug,
|
||||||
|
"NPC update spread distance set to [%i] combined_spread [%i]",
|
||||||
|
update_distance,
|
||||||
|
combined_spread
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -126,6 +126,9 @@ public:
|
|||||||
bool Process();
|
bool Process();
|
||||||
bool SaveZoneCFG();
|
bool SaveZoneCFG();
|
||||||
|
|
||||||
|
int GetNpcPositionUpdateDistance() const;
|
||||||
|
void SetNpcPositionUpdateDistance(int in_npc_position_update_distance);
|
||||||
|
|
||||||
char *adv_data;
|
char *adv_data;
|
||||||
|
|
||||||
const char *GetSpellBlockedMessage(uint32 spell_id, const glm::vec3 &location);
|
const char *GetSpellBlockedMessage(uint32 spell_id, const glm::vec3 &location);
|
||||||
@ -219,6 +222,7 @@ public:
|
|||||||
void ChangeWeather();
|
void ChangeWeather();
|
||||||
void ClearBlockedSpells();
|
void ClearBlockedSpells();
|
||||||
void ClearNPCTypeCache(int id);
|
void ClearNPCTypeCache(int id);
|
||||||
|
void CalculateNpcUpdateDistanceSpread();
|
||||||
void DelAggroMob() { aggroedmobs--; }
|
void DelAggroMob() { aggroedmobs--; }
|
||||||
void DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, uint32 zoneID);
|
void DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, uint32 zoneID);
|
||||||
void Despawn(uint32 spawngroupID);
|
void Despawn(uint32 spawngroupID);
|
||||||
@ -290,7 +294,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
find_replace(message, std::string("%"), std::string("."));
|
find_replace(message, std::string("%"), std::string("."));
|
||||||
|
|
||||||
if (message.find("\n") != std::string::npos) {
|
if (message.find('\n') != std::string::npos) {
|
||||||
auto message_split = SplitString(message, '\n');
|
auto message_split = SplitString(message, '\n');
|
||||||
entity_list.MessageStatus(
|
entity_list.MessageStatus(
|
||||||
0,
|
0,
|
||||||
@ -345,6 +349,7 @@ private:
|
|||||||
glm::vec4 m_Graveyard;
|
glm::vec4 m_Graveyard;
|
||||||
int default_ruleset;
|
int default_ruleset;
|
||||||
int totalBS;
|
int totalBS;
|
||||||
|
int npc_position_update_distance;
|
||||||
int32 aggroedmobs;
|
int32 aggroedmobs;
|
||||||
uint8 zone_type;
|
uint8 zone_type;
|
||||||
uint16 instanceversion;
|
uint16 instanceversion;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user