- Online Community Forums » Programming Questions » Game runs slow on slower computers

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Game runs slow on slower computers
Member #6,241
September 2005

Fair enough, so answer me this: since I know that everything except the paddles will move (bacground image doesn't count), it's safe to draw over where they were. But what's better for the paddles: using ifs to compare its previous position and seeing if they have moved, or just drawing within its movement range?

War Pong HD! Every time you don't download it, a kitten of hope dies in my heart. Please, save the imaginary kittens.

Kris Asick
Member #1,424
July 2001

If you use the dirty rectangle system I suggested, you must never redraw something which hasn't moved or it is sure to flicker. Also remembering never to erase an object without immediately redrawing it.

If you use the other dirty rectangle system suggested, where you keep a buffer but only copy changed parts to the screen, you have to blit the combined areas of where the object was and where it has moved to, so you should still track previous coordinates anyways and save yourself the extra calculations.

The best way to store previous coordinates is at the start of processing any movement for an object, simply store the current coordinates into the previous ones, then update the current ones. Then, at the end of processing movement, if the current and previous coordinates are still identical, the object hasn't moved and doesn't need to be redrawn.

--- Kris Asick (Gemini)

--- Kris Asick (Gemini)

 1   2 

Go to: