Development start of a new game using SDL

Hello!

I started developing a game using the SDL library. The name of this game
is BumpRacer. You can find the web page with windows and linux/glibc
binaries here:
http://members.xoom.com/karlba/bumpracer.html
The game is still very beta. I would be very happy if my game appears in
the download list at devolution.com/~slouken/SDL/

The source code will be released soon.

Bye,Karl.

Sam Lantinga wrote:

Hello!

I started developing a game using the SDL library. The name of this game
is BumpRacer. You can find the web page with windows and linux/glibc
binaries here:
http://members.xoom.com/karlba/bumpracer.html
The game is still very beta. I would be very happy if my game appears in
the download list at devolution.com/~slouken/SDL/

The source code will be released soon.

Hey, this game is really cool! I’d love to hear some sounds and maybe some
enemies. :slight_smile:

Sound will be implemented (I’m thinking of cool MODs), but at first I’ve to
program some kind of time check, so that this game runs at one speed on all
systems. Where can I find a good example for this (with threads this will work
best I think)?

Sound will be implemented (I’m thinking of cool MODs), but at first I’ve to
program some kind of time check, so that this game runs at one speed on all
systems. Where can I find a good example for this (with threads this will work
best I think)?

Most people use some variation on the following:
while ( game_on ) {
now = SDL_GetTicks();
if ( now < next_frame ) {
SDL_Delay(next_frame-now);
}
next_frame = SDL_GetTicks()+ticks_per_frame;
}

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Why do we need to GetTicks() two times per loop?
I think it can be optimized:

next_frame = SDL_GetTicks() + ticks_per_frame;

while ( game_on ) {
	ticks_to_delay = SDL_GetTicks() - nextframe;
	if ( ticks_to_delay > 0 ) {
		SDL_Delay(ticks_to_delay);
	}
	next_frame += ticks_per_frame;
	
	do_all_the_stuff();
}

-MicheleOn Fri, Mar 12, 1999 at 09:37:06AM -0800, Sam Lantinga wrote:

Most people use some variation on the following:
while ( game_on ) {
now = SDL_GetTicks();
if ( now < next_frame ) {
SDL_Delay(next_frame-now);
}
next_frame = SDL_GetTicks()+ticks_per_frame;
}

Why do we need to GetTicks() two times per loop?
I think it can be optimized:

next_frame = SDL_GetTicks() + ticks_per_frame;

while ( game_on ) {
ticks_to_delay = SDL_GetTicks() - nextframe;

this should be:
ticks_to_delay = next_frame - SDL_GetTicks();On Fri, Mar 12, 1999 at 11:36:18PM +0100, Michele Bini wrote:

  if ( ticks_to_delay > 0 ) {
  	SDL_Delay(ticks_to_delay);
  }
  next_frame += ticks_per_frame;
  
  do_all_the_stuff();

}

-Michele