mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Stabilize taxi/state sync and creature spawn handling
This commit is contained in:
parent
41a33249a5
commit
74062aa25f
18 changed files with 818 additions and 127 deletions
|
|
@ -162,6 +162,8 @@ private:
|
|||
uint32_t gryphonDisplayId_ = 0;
|
||||
uint32_t wyvernDisplayId_ = 0;
|
||||
bool lastTaxiFlight_ = false;
|
||||
float taxiLandingClampTimer_ = 0.0f;
|
||||
float worldEntryMovementGraceTimer_ = 0.0f;
|
||||
float taxiStreamCooldown_ = 0.0f;
|
||||
bool idleYawned_ = false;
|
||||
|
||||
|
|
@ -193,7 +195,7 @@ private:
|
|||
float x, y, z, orientation;
|
||||
};
|
||||
std::vector<PendingCreatureSpawn> pendingCreatureSpawns_;
|
||||
static constexpr int MAX_SPAWNS_PER_FRAME = 24;
|
||||
static constexpr int MAX_SPAWNS_PER_FRAME = 96;
|
||||
static constexpr uint16_t MAX_CREATURE_SPAWN_RETRIES = 300;
|
||||
std::unordered_set<uint64_t> pendingCreatureSpawnGuids_;
|
||||
std::unordered_map<uint64_t, uint16_t> creatureSpawnRetryCounts_;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
size_t getAvailableRAM() const;
|
||||
|
||||
/**
|
||||
* Get recommended cache budget (30% of available RAM)
|
||||
* Get recommended cache budget (80% of available RAM, capped at 90% of total RAM)
|
||||
*/
|
||||
size_t getRecommendedCacheBudget() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -623,6 +623,8 @@ public:
|
|||
void activateTaxi(uint32_t destNodeId);
|
||||
bool isOnTaxiFlight() const { return onTaxiFlight_; }
|
||||
bool isTaxiMountActive() const { return taxiMountActive_; }
|
||||
bool isTaxiActivationPending() const { return taxiActivatePending_; }
|
||||
void forceClearTaxiAndMovementState();
|
||||
const ShowTaxiNodesData& getTaxiData() const { return currentTaxiData_; }
|
||||
uint32_t getTaxiCurrentNode() const { return currentTaxiData_.nearestNode; }
|
||||
|
||||
|
|
@ -927,6 +929,8 @@ private:
|
|||
uint32_t pingSequence = 0; // Ping sequence number (increments)
|
||||
float timeSinceLastPing = 0.0f; // Time since last ping sent (seconds)
|
||||
float pingInterval = 30.0f; // Ping interval (30 seconds)
|
||||
float timeSinceLastMoveHeartbeat_ = 0.0f; // Periodic movement heartbeat to keep server position synced
|
||||
float moveHeartbeatInterval_ = 0.5f;
|
||||
uint32_t lastLatency = 0; // Last measured latency (milliseconds)
|
||||
|
||||
// Player GUID and map
|
||||
|
|
@ -1086,6 +1090,7 @@ private:
|
|||
float taxiActivateTimer_ = 0.0f;
|
||||
bool taxiClientActive_ = false;
|
||||
float taxiLandingCooldown_ = 0.0f; // Prevent re-entering taxi right after landing
|
||||
float taxiStartGrace_ = 0.0f; // Ignore transient landing/dismount checks right after takeoff
|
||||
size_t taxiClientIndex_ = 0;
|
||||
std::vector<glm::vec3> taxiClientPath_;
|
||||
float taxiClientSpeed_ = 32.0f;
|
||||
|
|
|
|||
|
|
@ -433,6 +433,9 @@ struct MovementInfo {
|
|||
*/
|
||||
class MovementPacket {
|
||||
public:
|
||||
static void writePackedGuid(network::Packet& packet, uint64_t guid);
|
||||
static void writeMovementPayload(network::Packet& packet, const MovementInfo& info);
|
||||
|
||||
/**
|
||||
* Build a movement packet
|
||||
*
|
||||
|
|
|
|||
|
|
@ -172,6 +172,15 @@ private:
|
|||
std::optional<float> cachedCamWmoFloor;
|
||||
bool hasCachedCamFloor = false;
|
||||
|
||||
// Terrain-aware camera pivot lift cache (throttled for performance).
|
||||
glm::vec3 lastPivotLiftQueryPos_ = glm::vec3(0.0f);
|
||||
float lastPivotLiftDistance_ = 0.0f;
|
||||
int pivotLiftQueryCounter_ = 0;
|
||||
float cachedPivotLift_ = 0.0f;
|
||||
static constexpr int PIVOT_LIFT_QUERY_INTERVAL = 3;
|
||||
static constexpr float PIVOT_LIFT_POS_THRESHOLD = 0.5f;
|
||||
static constexpr float PIVOT_LIFT_DIST_THRESHOLD = 0.5f;
|
||||
|
||||
// Cached floor height queries (update every 5 frames or 2 unit movement)
|
||||
glm::vec3 lastFloorQueryPos = glm::vec3(0.0f);
|
||||
std::optional<float> cachedFloorHeight;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue