Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Fixed update added

Fixed update added

Byron
Yet Another Game Maker · · 1 min read
1,246 2
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);	}}

Discussion

Loading comments...