Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    18
  • comments
    20
  • views
    8995

Fixed update added

Sign in to follow this  
Byron

410 views

Thanks for the welcome people!

Well, I added in the fixed rate update after reading:

http://www.gaffer.org/fix-your-timestep

my version is not identical (I don't lerp states for instance) and to be honest - this is the first round of this going in - I will see how it handles before going further.

Here's the code I used:


void CTitle::FrameUpdate(float fTimeDelta)
{

// Add the delta to the record
CSystemInfo::AddFrameDelta(fTimeDelta);

// Clamp the delta if necessary
if(fTimeDelta > 0.25f)
{
fTimeDelta = 0.0f;
}

m_fAccumulator += fTimeDelta;

while(m_fAccumulator >= FRAME_DELTA)
{
m_fAccumulator -= FRAME_DELTA;


if(CSystemInfo::ShouldWeBeDisplayingAScrollingBackground())
{
CScrollingFullScreenQuad::Update(FRAME_DELTA);
}

if(CPlayer::GetStatus() == PLAYER_STATUS_ALIVE)
{
CPlayer::Update(FRAME_DELTA);
}

CEvents::Update(FRAME_DELTA);
CPathDatabase::Update(FRAME_DELTA);
CPathEmitter::UpdateEmitters(FRAME_DELTA);
CPathFollower::UpdateFollowers(FRAME_DELTA);
CActor::Update(FRAME_DELTA);
CExplosion::Update(FRAME_DELTA);
CEmitters::Update(FRAME_DELTA);
CParticles::Update(FRAME_DELTA);


}

}

Sign in to follow this  


2 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!