During the last weeks I had to try to improve the framerate for my game on slower/older machines.
At the first glance I tried to decrease the amount of graphics drawn each frame... so when there was a big sprite which had some smaller sprites drawn on it on every time the same relative position, I locked this sprite and drew the smaller sprites on it to save some drawimage-commands.
On older pcs (with older gfx-cards, mainly onboard like the sis or via-chips) there was not such a huge increase. So I thought about dirty-rects, but I do not believe in BlitzMax being able to work this way (eg multiple flips per frame with viewports set to dirtyrects?). Someone out there who is able to convince me of dirty-rects being possible?
Another try was a type "TDirtyImage" I created yesterday... every big sprite (interface-backgrounds, or an skyscraper which is the "level" of my game) is splitted into many small frames. Every DirtyImage is updated per frame and checked for being dirty. E.g. it's checked if the mouseimage is overlapping the dirty-rectangle, if so then the image is marked dirty and drawn with the DirtyRect.Draw(x,y)-method.
Although this works - and gives a small increase, the performance hit was not bigger than 20%. And for myself struggling with lower than 70 fps on the mainscreen (and on my older pc) its to dangerous to believe in constantly over 60fps.
So, to make this post have a finish: What do you do, to increase the (possible) framerate of your application?
I know that newer pcs and newer graphic-cards will not have problems, but for a 2D-game running on a >2GHz cpu with an graphicscard having 64mb (shared) vram I'm not really convinced of Max2D (I know it's 3D to have alpha blending and so on ... but it is still scaring me).
Are there any tips especially for huge sprites (800x200, 500x1000) - SetViewPort and loading them as Animated Image (and drawing the frames separately) or splitting the images and load them separately brings nearly no effect. The only really measurable increase was possible when removing "cls" and just drawing things which are marked dirty.
bye and thanks for your help,
MB
At the first glance I tried to decrease the amount of graphics drawn each frame... so when there was a big sprite which had some smaller sprites drawn on it on every time the same relative position, I locked this sprite and drew the smaller sprites on it to save some drawimage-commands.
On older pcs (with older gfx-cards, mainly onboard like the sis or via-chips) there was not such a huge increase. So I thought about dirty-rects, but I do not believe in BlitzMax being able to work this way (eg multiple flips per frame with viewports set to dirtyrects?). Someone out there who is able to convince me of dirty-rects being possible?
Another try was a type "TDirtyImage" I created yesterday... every big sprite (interface-backgrounds, or an skyscraper which is the "level" of my game) is splitted into many small frames. Every DirtyImage is updated per frame and checked for being dirty. E.g. it's checked if the mouseimage is overlapping the dirty-rectangle, if so then the image is marked dirty and drawn with the DirtyRect.Draw(x,y)-method.
Although this works - and gives a small increase, the performance hit was not bigger than 20%. And for myself struggling with lower than 70 fps on the mainscreen (and on my older pc) its to dangerous to believe in constantly over 60fps.
So, to make this post have a finish: What do you do, to increase the (possible) framerate of your application?
I know that newer pcs and newer graphic-cards will not have problems, but for a 2D-game running on a >2GHz cpu with an graphicscard having 64mb (shared) vram I'm not really convinced of Max2D (I know it's 3D to have alpha blending and so on ... but it is still scaring me).
Are there any tips especially for huge sprites (800x200, 500x1000) - SetViewPort and loading them as Animated Image (and drawing the frames separately) or splitting the images and load them separately brings nearly no effect. The only really measurable increase was possible when removing "cls" and just drawing things which are marked dirty.
bye and thanks for your help,
MB