Fixed update added

Published September 23, 2006
Advertisement
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);	}}
Previous Entry Fixed rate update
Next Entry Defeating lag
0 likes 2 comments

Comments

HopeDagger
Uber! That's roughly how I implement it in my games, and it works wonders. [smile]
September 23, 2006 05:51 PM
Byron
Yeah - it seems to work so far.

September 23, 2006 05:58 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement