PixelBlitz – Optimised RenderLayer part 1

Tonight I updated the PixelBlitz Engine with a small but significant feature. I attacked the issue of redundant redrawing of elements, and updated both the PixelSprite and RenderLayer classes so they no longer refresh all of their content if nothing has actually changed since the last render call.

Sounds simple and it is, but it makes a world of difference to the speed of things.

I’ve been researching how beneficial adding a dirty rect system in the engine would be. The problem I have is that it’s all dependant on the type of game. For example a vertical shooter, with a scrolling background and bullets flying everywhere, would have no benefit at all – if anything the extra calculations may even slow it down. But in a sedate game, especially one with large (overlapping) objects, it could be a dream.

So, still in two minds really – perhaps it’s something we allow the user to disable at will.

For now I’m going to optimise the 2DRenderer further by making it only copyPixels() from the area of the RenderLayer that has changed. At the moment it grabs a full sized layer even if the layer only contains say a 64×64 sprite somewhere.

Anyway until then the new code is available in svn.

Posted on September 19th 2008 at 8:18 pm by .
View more posts in PixelBlitz. Follow responses via the RSS 2.0 feed.

2 Responses

Leave a comment

Make yourself heard