Condense frame rates

This commit is contained in:
EmosewaMC
2022-12-15 19:55:07 -08:00
parent e1cc25759e
commit 4775dbf27f
7 changed files with 24 additions and 34 deletions

View File

@@ -2,23 +2,18 @@
#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,13 +67,6 @@ 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);

View File

@@ -8,18 +8,13 @@ struct PerformanceProfile {
uint32_t serverFramerate;
};
class PerformanceManager {
public:
~PerformanceManager();
static void SelectProfile(LWOMAPID mapID);
static uint32_t GetServerFramerate();
private:
PerformanceManager();
static PerformanceProfile m_CurrentProfile;
static PerformanceProfile m_DefaultProfile;
static PerformanceProfile m_InactiveProfile;

View File

@@ -232,7 +232,7 @@ int main(int argc, char** argv) {
bool ready = false;
int framesSinceMasterStatus = 0;
int framesSinceShutdownSequence = 0;
int currentFramerate = highFrameRate;
int currentFramerate = highFrameDelta;
int ghostingStepCount = 0;
auto ghostingLastTime = std::chrono::high_resolution_clock::now();
@@ -300,7 +300,7 @@ int main(int argc, char** argv) {
const auto occupied = UserManager::Instance()->GetUserCount() != 0;
if (!ready) {
currentFramerate = highFrameRate;
currentFramerate = highFrameDelta;
} else {
currentFramerate = PerformanceManager::GetServerFramerate();
}