Simple speed question...

BlitzPlus Forums/BlitzPlus Beginners Area/Simple speed question...

Buggy(Posted 2006) [#1]
Would it be more efficient to have a "changed" variable, and only clear the screen and draw things if anything has changed, or to just redraw things every frame?

Would the answer be different if I had a mouse pointer in my game?

Would the answer be different if it were an online game?


WolRon(Posted 2006) [#2]
1) Obviously, only updating the screen if something has changed would be the most efficient. It is however, not as easy as completely redrawing the screen all of the time.

2) No.

3) I don't completely understand your third question. Define online game.


CS_TBL(Posted 2006) [#3]
1) I always count with the worst case scenario.. in this WCS you need redraw the whole screen, so your performance needs to cope with that. In that case you can as well redraw the whole thing at once.


Buggy(Posted 2006) [#4]
Thanks WolRon. By "online game," I meant a game that has to send packets to other computers constantly. I think it would be faster if the game didn't have to send packets every frame... only when things change.

So does that mean that I should use this technique for my games? The "changed" variable technique?


Grey Alien(Posted 2006) [#5]
My XMas Bonus game oringally drew the entire screen, but it could drop frames on a <2GHz Machine so I changed it all to a dirty rects system and it now works on a 500MHz system. In the Amiga days you had to redraw changed areas only as they weren't powerful enough to do the whole screen whereas PCs are, but only modern ones really. If you are making a scrolling game you may have to redraw it all each frame anyway. Only updating changed areas is hard, especially as there are two buffers in full-screen mode and only one in windowed mode.


Buggy(Posted 2006) [#6]
I'm doing a board game, so I think I'll try the "changed" idea. Thanks.