[SDL] Non-network lag?

L-28C leo28c at gmail.com
Sun Sep 10 17:18:03 PDT 2006


Hey Alan! :-D
You mean like this:

=====================================
// Main game loop
while (true)
{
	// Get the current time
	float newTime = (float) SDL_GetTicks();

	float deltaTime = newTime - currentTime;
	currentTime = newTime;

	accumulator += deltaTime;

	while (accumulator >= dt)
	{
		game.Respond();
		t += dt;
		accumulator -= dt;
	}

	game.Render();

	SDL_Delay(10);
}
=====================================

That's what I have...  Thanks!

Alan Wolfe wrote:
> Hey Leo, do you have any "fixed rate" logic in your game?
> 
> -----Original Message-----
> From: sdl-bounces+atrix2=cox.net at libsdl.org
> [mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of L-28C
> Sent: Sunday, September 10, 2006 12:01 AM
> To: sdl at libsdl.org
> Subject: [SDL] Non-network lag?
> 
> Hello everyone!
> OK, my game runs fine on a 2.8GHz laptop, but it runs kinda skippy on 
> another 1.4GHz comp...  I mean, both run at the same actual speed... 
> Like, if I put them both at the right side of the screen and push the 
> Left key at the same time, they both get to the left side at the same 
> time...  But the 1.4GHz is laggy...  Is there a common workaround to 
> this, or should I post some code?  Thanks! ;-)
> 


-- 
~ Leo, M@$73r L3170, Sulfurik, Kixdemp, L-28C... Whatever you wanna call me.





More information about the SDL mailing list