mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Add dynamic memory-based asset caching and aggressive loading
- Add MemoryMonitor class for dynamic cache sizing based on available RAM - Increase terrain load radius to 8 tiles (17x17 grid, 289 tiles) - Scale worker threads to 75% of logical cores (no cap) - Increase cache budget to 80% of available RAM, max file size to 50% - Increase M2 render distance: 1200 units during taxi, 800 when >2000 instances - Fix camera positioning during taxi flights (external follow mode) - Add 2-second landing cooldown to prevent re-entering taxi mode on lag - Update interval reduced to 33ms for faster streaming responsiveness Optimized for high-memory systems while scaling gracefully to lower-end hardware. Cache and render distances now fully utilize available VRAM on minimum spec GPUs.
This commit is contained in:
parent
27d0496894
commit
c047446fb7
12 changed files with 198 additions and 19 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "pipeline/asset_manager.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include "core/memory_monitor.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace wowee {
|
||||
|
|
@ -25,8 +26,14 @@ bool AssetManager::initialize(const std::string& dataPath_) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Set dynamic file cache budget based on available RAM
|
||||
auto& memMonitor = core::MemoryMonitor::getInstance();
|
||||
size_t recommendedBudget = memMonitor.getRecommendedCacheBudget();
|
||||
fileCacheBudget = recommendedBudget / 2; // Split budget: half for file cache, half for other caches
|
||||
|
||||
initialized = true;
|
||||
LOG_INFO("Asset manager initialized successfully (1GB file cache enabled)");
|
||||
LOG_INFO("Asset manager initialized (dynamic file cache: ",
|
||||
fileCacheBudget / (1024 * 1024), " MB, adjusts based on RAM)");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -169,9 +176,9 @@ std::vector<uint8_t> AssetManager::readFile(const std::string& path) const {
|
|||
|
||||
// Add to cache if within budget
|
||||
size_t fileSize = data.size();
|
||||
if (fileSize > 0 && fileSize < FILE_CACHE_BUDGET / 10) { // Don't cache files > 100MB
|
||||
if (fileSize > 0 && fileSize < fileCacheBudget / 2) { // Don't cache files > 50% of budget (very aggressive)
|
||||
// Evict old entries if needed (LRU)
|
||||
while (fileCacheTotalBytes + fileSize > FILE_CACHE_BUDGET && !fileCache.empty()) {
|
||||
while (fileCacheTotalBytes + fileSize > fileCacheBudget && !fileCache.empty()) {
|
||||
// Find least recently used entry
|
||||
auto lru = fileCache.begin();
|
||||
for (auto it = fileCache.begin(); it != fileCache.end(); ++it) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue