Reduce runtime streaming stutter by throttling heavy spawn workloads

- Add per-frame cap for first-time creature model loads to spread expensive model/texture decode work across frames instead of burst loading.

- Keep cached creature spawns flowing while deferring uncached display IDs, preserving world population updates with smoother frame pacing.

- Defer transport WMO doodad instancing into a queued batch processor with a strict per-frame budget to avoid multi-hundred-ms spikes when ships/elevators register.

- Process deferred transport doodad batches in both normal gameplay update and loading-screen warmup loop so heavy transport setup can be amortized before and after world entry.

- Cleanup pending transport doodad batches on gameobject despawn to prevent stale work and avoid attaching children to removed parents.

- Lower character texture cache miss logging from INFO to DEBUG to reduce log I/O contention during movement-heavy asset streaming.
This commit is contained in:
Kelsi 2026-02-20 20:00:44 -08:00
parent 2da2e75253
commit 48d9de810d
3 changed files with 123 additions and 44 deletions

View file

@ -240,6 +240,7 @@ private:
};
std::vector<PendingCreatureSpawn> pendingCreatureSpawns_;
static constexpr int MAX_SPAWNS_PER_FRAME = 8;
static constexpr int MAX_NEW_CREATURE_MODELS_PER_FRAME = 1;
static constexpr uint16_t MAX_CREATURE_SPAWN_RETRIES = 300;
std::unordered_set<uint64_t> pendingCreatureSpawnGuids_;
std::unordered_map<uint64_t, uint16_t> creatureSpawnRetryCounts_;
@ -289,6 +290,21 @@ private:
};
std::vector<PendingGameObjectSpawn> pendingGameObjectSpawns_;
void processGameObjectSpawnQueue();
struct PendingTransportDoodadBatch {
uint64_t guid = 0;
uint32_t modelId = 0;
uint32_t instanceId = 0;
size_t nextIndex = 0;
size_t doodadBudget = 0;
size_t spawnedDoodads = 0;
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float orientation = 0.0f;
};
std::vector<PendingTransportDoodadBatch> pendingTransportDoodadBatches_;
static constexpr size_t MAX_TRANSPORT_DOODADS_PER_FRAME = 12;
void processPendingTransportDoodads();
// Quest marker billboard sprites (above NPCs)
void loadQuestMarkerModels(); // Now loads BLP textures