mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 09:28:06 +00:00
Merge branch 'main' into guild_temp
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
#include "ObjectIDManager.h"
|
||||
|
||||
// Std
|
||||
#include <random>
|
||||
|
||||
// Custom Classes
|
||||
#include "MasterPackets.h"
|
||||
#include "Database.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "Game.h"
|
||||
|
||||
// Static Variables
|
||||
@@ -48,11 +45,7 @@ void ObjectIDManager::HandleRequestPersistentIDResponse(uint64_t requestID, uint
|
||||
|
||||
//! Handles cases where we have to get a unique object ID synchronously
|
||||
uint32_t ObjectIDManager::GenerateRandomObjectID() {
|
||||
std::random_device rd;
|
||||
|
||||
std::mt19937 rng(rd());
|
||||
|
||||
return uni(rng);
|
||||
return uni(Game::randomEngine);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,24 +1,20 @@
|
||||
#include "PerformanceManager.h"
|
||||
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "UserManager.h"
|
||||
|
||||
//Times are 1 / fps, in ms
|
||||
#define HIGH 16 //60 fps
|
||||
#define MEDIUM 33 //30 fps
|
||||
#define LOW 66 //15 fps
|
||||
|
||||
#define SOCIAL { LOW }
|
||||
#define SOCIAL_HUB { MEDIUM } //Added to compensate for the large playercounts in NS and NT
|
||||
#define BATTLE { HIGH }
|
||||
#define BATTLE_INSTANCE { MEDIUM }
|
||||
#define RACE { HIGH }
|
||||
#define PROPERTY { LOW }
|
||||
#define SOCIAL { lowFrameDelta }
|
||||
#define SOCIAL_HUB { mediumFrameDelta } //Added to compensate for the large playercounts in NS and NT
|
||||
#define BATTLE { highFrameDelta }
|
||||
#define BATTLE_INSTANCE { mediumFrameDelta }
|
||||
#define RACE { highFrameDelta }
|
||||
#define PROPERTY { lowFrameDelta }
|
||||
|
||||
PerformanceProfile PerformanceManager::m_CurrentProfile = SOCIAL;
|
||||
|
||||
PerformanceProfile PerformanceManager::m_DefaultProfile = SOCIAL;
|
||||
|
||||
PerformanceProfile PerformanceManager::m_InactiveProfile = { LOW };
|
||||
PerformanceProfile PerformanceManager::m_InactiveProfile = { lowFrameDelta };
|
||||
|
||||
std::map<LWOMAPID, PerformanceProfile> PerformanceManager::m_Profiles = {
|
||||
// VE
|
||||
@@ -72,29 +68,41 @@ std::map<LWOMAPID, PerformanceProfile> PerformanceManager::m_Profiles = {
|
||||
{ 2001, BATTLE_INSTANCE },
|
||||
};
|
||||
|
||||
|
||||
PerformanceManager::PerformanceManager() {
|
||||
}
|
||||
|
||||
PerformanceManager::~PerformanceManager() {
|
||||
}
|
||||
|
||||
void PerformanceManager::SelectProfile(LWOMAPID mapID) {
|
||||
const auto pair = m_Profiles.find(mapID);
|
||||
// Try to get it from zoneTable
|
||||
CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
|
||||
if (zoneTable) {
|
||||
const CDZoneTable* zone = zoneTable->Query(mapID);
|
||||
if (zone) {
|
||||
if (zone->serverPhysicsFramerate == "high"){
|
||||
m_CurrentProfile = { highFrameDelta };
|
||||
return;
|
||||
}
|
||||
if (zone->serverPhysicsFramerate == "medium"){
|
||||
m_CurrentProfile = { mediumFrameDelta };
|
||||
return;
|
||||
}
|
||||
if (zone->serverPhysicsFramerate == "low"){
|
||||
m_CurrentProfile = { lowFrameDelta };
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to hardcoded list and defaults
|
||||
const auto pair = m_Profiles.find(mapID);
|
||||
if (pair == m_Profiles.end()) {
|
||||
m_CurrentProfile = m_DefaultProfile;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_CurrentProfile = pair->second;
|
||||
}
|
||||
|
||||
uint32_t PerformanceManager::GetServerFramerate() {
|
||||
uint32_t PerformanceManager::GetServerFrameDelta() {
|
||||
if (UserManager::Instance()->GetUserCount() == 0) {
|
||||
return m_InactiveProfile.serverFramerate;
|
||||
return m_InactiveProfile.serverFrameDelta;
|
||||
}
|
||||
|
||||
return m_CurrentProfile.serverFramerate;
|
||||
return m_CurrentProfile.serverFrameDelta;
|
||||
}
|
||||
|
@@ -5,21 +5,16 @@
|
||||
#include "dCommonVars.h"
|
||||
|
||||
struct PerformanceProfile {
|
||||
uint32_t serverFramerate;
|
||||
uint32_t serverFrameDelta;
|
||||
};
|
||||
|
||||
|
||||
class PerformanceManager {
|
||||
public:
|
||||
~PerformanceManager();
|
||||
|
||||
static void SelectProfile(LWOMAPID mapID);
|
||||
|
||||
static uint32_t GetServerFramerate();
|
||||
static uint32_t GetServerFrameDelta();
|
||||
|
||||
private:
|
||||
PerformanceManager();
|
||||
|
||||
static PerformanceProfile m_CurrentProfile;
|
||||
static PerformanceProfile m_DefaultProfile;
|
||||
static PerformanceProfile m_InactiveProfile;
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user