Jump to content
  • Advertisement
Sign in to follow this  
willthiswork89

stopping the dreded "Speeder!"

This topic is 5095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im making an rpg game and before i start i wanna fix the speeder problem, how can i do this using sdl? i made my timer class but it uses sdl GetTicks which uses the program when it started, not the systme clock...so can someone help me out?

Share this post


Link to post
Share on other sites
Advertisement
Speeder problem? You mean a lack of framerate independence? What I usually do is the delta time system.

In your game loop:
float delta = 0.0f;
while(!gameover) {
start = SDL_GetTicks();

// your game stuff

player.x += PLAYER_SPEED_PIXELS_PER_SECOND * delta;

// end your game stuff
delta = (SDL_GetTicks() - start) / 1000.0f;
}


Just get the interval between frames, convert it into seconds and then adjust your movement, etc in terms of "per second" (i.e. speed per second, rotation per second, etc) and multiply it by the delta.

Share this post


Link to post
Share on other sites
heres what i got

while( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
{
//wait
}

and that still makes the frame rate incredibly fast, when using a speeder you know to make things run faster on your computer? its going to be really fast when using anything besides the actual system clock

Share this post


Link to post
Share on other sites
well thats exactly what mine is doing, getting the ticks from when it started to now, if its less then 1000 then it needs to wait, i beleive yours does that exactly. and that doesnt stop a speeder for capping frame rate

Share this post


Link to post
Share on other sites
Well, mine reduces the amount things move depending on how long it took to render the last frame -- if you have a small enough delta time it should be not only smooth (if you use floating point numbers for positioning) but should work fine on vastly faster computers (or "speed up" utilities, I suppose).

Mine doesn't attempt to limit the framerate at all.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hello Ravuya.

I think what the above person is trying to say, is that there is these "cheat" programs out there that "speed up" system timers. When these types of programs are ran on a computer, mostly anything animation related is sped up incredibly. For example if i open up an animated .gif in internet explorer, the animation looks normal. When i run a "speeder" program, that animation is sped up by atleast 500%.

The program i speak of is available at download.com.

A Speeder.
Win Speeder.
Speed Gear.

These three programs do this, and this affects alot of 2d games and even 3d games.

Back in the day people use to cheat in Counter-Strike using "speedhack" using a japanese program that used this speed up technology that is now used in the above 3 programs.

He is trying to find a way to code his game so that this program doesn't affect his game because it could be used to cheat in online play. Ex: Moving at 5x the speed of everyone else. Cheating.

Thanks for reading :)

Share this post


Link to post
Share on other sites
Ah ha!

Thanks for the clarification.

You can do this with my delta time system too -- just detect if the delta is too large (say, over 0.1f) and cap it to some arbitrary value. This will also prevent people from lagging out the system to get larger delta time steps and going through walls, etc.

I don't think there's much you can do with this system if they are in fact bollocking the SDL timer; you could always use the system time (through time.h) for sanity checking if you really need it. I see no reason to do so for a single player game except to skip boring dialogue, etc though.

If you are doing a client/server application, your server should be sanity checking every move packet -- "how far did this guy move? does it make sense that he moved this far?" -- and if it's not right, you shouldn't accept it (or punt the player).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!