If you use a value when you move objects, simply multiply everything with the speed. So if you have method MoveObject(int x, int y) and in it you have a global variable that multiply the speed . Player.Location.X += (x*GameSpeed) for example. Then, whenever you need to change the speed you just increase or decrease the global value (GameSpeed).
–
DeukalionDec 13 '12 at 8:00

3 Answers
3

In most update methods there is a delta, which provides the number of milliseconds (or some other measurement of time) since the last update was called. By calculating all of your movement calculations using both a delta and a movement speed, you get movement that is unaffected by a fluctuating frame rate.

The following is code pulled from the movement system of an Asteroids clone I'm working on (but modified to make my point more clear):

Notice that the actual change of coordinates happens based on the amount of time passed. By modifying the delta passed into your system with some multiplier, you can make things in your game move more quickly or slowly:

When performing speedup by changing the timestep, it might mean the behaviour is different. For example, if you have some physics in there with euler integration, the behaviour at double speed will diverge over time.

This is not a problem in 99% of cases, but it is something you should be aware of.

If you are multiplying speed by an integer as you are in your example, I would suggest doing multiple updates per frame with fixed timestep. This will ensure your simulation always behaves exactly the same way but at double, triple or quadruple speed.

This is of course more cpu intensive because you are doing double the simulation processing.

One very important thing to note: your update and drawing functionality should be completely separate, but this should ALWAYS be the case anyway, in any project. What I mean is, your display function should not change ANY state, it should ONLY draw the scene at the current time.

I'm not saying this is how you should do it, but it is very simple to implement and is another method to think about.