Selective Tile Map Refreshing This is a quick example of a dirty rectangle style refresh using a tile map. The example allows you to render a 'static' backdrop page with a bunch of the sprites moving over it. The primary objective of such approaches is to reduce the cost per pixel. For example, In order to support Alpha effects we'd normally draw everything to an off screen FX surface. So in order to the build the frame we'd clear/redraw the backdrop, draw our sprites over that. Then draw the whole buffer to the screen. So every pixel is being rendered at least twice. This cost adds up, no matter how fast the machine is.
This kind of process,
RenderToIMage FXScreen
DrawImage BackDropPicture,0,0,false ; (Redraw the backdrop to reset the scene)
DrawAllSprites
RenderToScreen
DRawIMage FXScreen,0,0,false
Sync
However when selectively refreshing, rather than redraw the backdrop to clear the screen each frame, we can manage what parts of the backdrop picture need to 'redrawn' in order to restore the backdrop image to it's original state (before the sprites we're drawn over it) . So if there's only one sprite on screen for example, then we're only refreshing the pixels behind it. So only those pixels are being drawn twice. Making it a much more efficient approach for single screen games with a few characters on them.
There's a tipping point however, if at some point the entire backdrop needs to be refreshed (Screen fulll of sprites for example), then our efficiency will doubt be slow the good old copy over loop above.
Example Written in PB1.64 (Should work 1.63 editions also though)