- disabled staggered unit updates
This commit is contained in:
parent
65cf1bfdac
commit
0e3c0a8d0e
|
@ -558,9 +558,11 @@ void Game::update(){
|
|||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
//renderer.updateParticleManager(rsGame,lastRenderFps);
|
||||
renderer.updateParticleManager(rsGame);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
//if(avgRenderFps >= 10 || world.getFrameCount() % 2 == 0) {
|
||||
//renderer.updateParticleManager(rsGame,lastRenderFps);
|
||||
renderer.updateParticleManager(rsGame,avgRenderFps);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
//}
|
||||
|
||||
//good_fpu_control_registers(NULL,__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
@ -1220,7 +1222,7 @@ void Game::render3d(){
|
|||
//shadow map
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
chrono.start();
|
||||
renderer.renderShadowsToTexture(lastRenderFps);
|
||||
renderer.renderShadowsToTexture(avgRenderFps);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
|
||||
//clear buffers
|
||||
|
@ -1232,7 +1234,7 @@ void Game::render3d(){
|
|||
//surface
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
chrono.start();
|
||||
renderer.renderSurface(lastRenderFps,world.getFrameCount());
|
||||
renderer.renderSurface(avgRenderFps,world.getFrameCount());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
|
||||
//selection circles
|
||||
|
@ -1244,13 +1246,13 @@ void Game::render3d(){
|
|||
//units
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
chrono.start();
|
||||
renderer.renderUnits(lastRenderFps,world.getFrameCount());
|
||||
renderer.renderUnits(avgRenderFps,world.getFrameCount());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
|
||||
//objects
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
chrono.start();
|
||||
renderer.renderObjects(lastRenderFps,world.getFrameCount());
|
||||
renderer.renderObjects(avgRenderFps,world.getFrameCount());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d renderFps = %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
|
||||
//water
|
||||
|
|
|
@ -475,9 +475,9 @@ void Renderer::manageParticleSystem(ParticleSystem *particleSystem, ResourceScop
|
|||
}
|
||||
|
||||
void Renderer::updateParticleManager(ResourceScope rs, int renderFps) {
|
||||
if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING) {
|
||||
particleManager[rs]->update();
|
||||
}
|
||||
//if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING) {
|
||||
particleManager[rs]->update(renderFps);
|
||||
//}
|
||||
}
|
||||
|
||||
void Renderer::renderParticleManager(ResourceScope rs){
|
||||
|
|
|
@ -48,7 +48,7 @@ World::World(){
|
|||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
Config &config= Config::getInstance();
|
||||
|
||||
staggeredFactionUpdates = true;
|
||||
staggeredFactionUpdates = false;
|
||||
ExploredCellsLookupItemCache.clear();
|
||||
ExploredCellsLookupItemCacheTimer.clear();
|
||||
ExploredCellsLookupItemCacheTimerCount = 0;
|
||||
|
@ -346,10 +346,7 @@ void World::update(){
|
|||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
//tick
|
||||
bool needToTick = (frameCount % GameConstants::updateFps == 0);
|
||||
if(staggeredFactionUpdates == true) {
|
||||
needToTick = (frameCount % (GameConstants::updateFps / GameConstants::maxPlayers) == 0);
|
||||
}
|
||||
bool needToTick = canTickWorld();
|
||||
if(needToTick == true) {
|
||||
//if(frameCount % (GameConstants::updateFps / GameConstants::maxPlayers) == 0) {
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
@ -358,6 +355,16 @@ void World::update(){
|
|||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
bool World::canTickWorld() const {
|
||||
//tick
|
||||
bool needToTick = (frameCount % GameConstants::updateFps == 0);
|
||||
if(staggeredFactionUpdates == true) {
|
||||
needToTick = (frameCount % (GameConstants::updateFps / GameConstants::maxPlayers) == 0);
|
||||
}
|
||||
|
||||
return needToTick;
|
||||
}
|
||||
|
||||
int World::getUpdateFps(int factionIndex) const {
|
||||
int result = GameConstants::updateFps;
|
||||
//if(factionIndex != -1 && staggeredFactionUpdates == true) {
|
||||
|
|
|
@ -191,6 +191,7 @@ public:
|
|||
std::string DumpWorldToLog(bool consoleBasicInfoOnly = false) const;
|
||||
|
||||
int getUpdateFps(int factionIndex) const;
|
||||
bool canTickWorld() const;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ private:
|
|||
|
||||
public:
|
||||
~ParticleManager();
|
||||
void update();
|
||||
void update(int renderFps=-1);
|
||||
void render(ParticleRenderer *pr, ModelRenderer *mr) const;
|
||||
void manage(ParticleSystem *ps);
|
||||
void end();
|
||||
|
|
|
@ -914,20 +914,24 @@ void ParticleManager::render(ParticleRenderer *pr, ModelRenderer *mr) const{
|
|||
}
|
||||
}
|
||||
|
||||
void ParticleManager::update() {
|
||||
void ParticleManager::update(int renderFps) {
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
//const int MIN_FPS_NORMAL_RENDERING = 10;
|
||||
int particleSystemCount = particleSystems.size();
|
||||
int particleCount = 0;
|
||||
list<ParticleSystem*>::iterator it;
|
||||
for (it=particleSystems.begin(); it!=particleSystems.end(); it++) {
|
||||
particleCount += (*it)->getAliveParticleCount();
|
||||
(*it)->update();
|
||||
if((*it)->isEmpty()) {
|
||||
delete *it;
|
||||
*it= NULL;
|
||||
}
|
||||
//if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING ||
|
||||
// dynamic_cast<UnitParticleSystem *>((*it)) == NULL) {
|
||||
(*it)->update();
|
||||
if((*it)->isEmpty()) {
|
||||
delete *it;
|
||||
*it= NULL;
|
||||
}
|
||||
//}
|
||||
}
|
||||
particleSystems.remove(NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue