which method is faster?

Blitz3D Forums/Blitz3D Programming/which method is faster?

Slomas(Posted 2011) [#1]
I’m writing a strategy game in 2D with an ‘isometric’ perspective, e.g. like Sim City,

So without the 3D engine to sort out the order, I need to draw all the objects from furthest to nearest (top to bottom) of the screen so they hide each other correctly right?

I'm trying to keep everything as CPU efficient as possible to maintain a nice smooth 60fps.


I’m wondering if it’s faster to draw all the objects individually each frame ... (just to the part of the back buffer that will become visible)
Or to use a 'world-sized' image buffer- updated only when objects are added or removed-
and then paste that entire image buffer as an overlay each frame?


The world is several times bigger than the display viewport- so one factor to this would be- how much of a CPU burden are pixels drawn off screen compared to on screen?

And would the image buffer technique become slower with more objects/ less black/transparent space?


Any thoughts much appreciated!

Last edited 2011


ClayPigeon(Posted 2011) [#2]
I would simply render any objects that are not completely outside the viewport only. This can be done by testing whether or not the object is further than half its size from the border of the viewport. This can be performed each frame without any FPS drop. That is unless you have some ridiculous amount of objects like >1000... Then I might think about doing the world-sized image buffer thing.

Last edited 2011


Matty(Posted 2011) [#3]
Only draw what is going to be on the screen. Don't draw anything that is occluded completely by another object.

2D in blitz is fast enough for an isometric engine...even if sloppily coded (not saying your code is sloppy but I know that even if I code something in haphazard sub-optimal way modern machines are more than capable of handling it ... usually)