Xtreme
11-03-2001, 12:00 PM
I am trying to get the fps up on my direct x 7 isometric tile game. Well in isometric tiles you have to blt everything transparent but i was trying to think up of ways to improve speed. Here is my thought. (Please keep in mind i am blitting first the ground then the other objects such as trees etc). If i blt once the ground tiles (the grass and all) with transparancy only once onto a seperate surface called ground then blt that surface without trancparancy (i'm not really sure how that would be done - with a flip mabey - and then blt with transparency the object tiles like trees etc. Therefore you would only have to have bltd the ground tiles once and use that as a still picture and blt your transparencies on top of that. Does anyone think this will be faster(or/and know how to do it?)
Squirm
11-03-2001, 03:44 PM
Well, if you plan on blting the tiles onto this temp surface every refresh, then no, infact performance will decrease. If, however, you only blt to the hidden surface when explicitly required, then it would give a speed increase.
Your temp surface can be a normal OFFSCREENPLAIN as you would use to hold a bitmap. You would make it the same height and width as the screen I would guess, any larger would certainly use up excess video/system memory. I would not suggest having one huge surface to store the whole game world and the blt portions of it.
If you are getting low FPS, you can improve this by reducing the number of blts you need to do per screen. We can do this using culling, which means we only try to blt tiles that will actually be visible. Another is to increase the size of the tiles, or blt the tiles in groups of 4. You might also want to do away completely with 2D operations and then setup your tiles as textures and apply them to a series of TLVertexes which match the blt co-ordinates. Using colkeys in this way greatly increases speed. There are many methods.
I would suggest trying your idea as I mentioned above, and also try increasing the size of the tiles. Also, your FPS deficit might not be due to your blting operations (though I suspect it is). You can test this by commenting out the blt operations and then testing it and see how the FPS varies.
Xtreme
11-03-2001, 03:51 PM
Thanks for the reply. I will try my idea and if i get a chance i'll let you know how it worked.
Xtreme
11-03-2001, 05:00 PM
i am using this code to initialize the surface called ground
Set Ground = Nothing
ddsurf2.lFlags = DDSD_CAPS
ddsurf2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set Ground = DDraw.CreateSurface(ddsurf2)
Ground_RECT.Left = 0
Ground_RECT.Top = 0
Ground_RECT.Right = 640
Ground_RECT.Bottom = 480
and this is the blt statement
Ground.BltFast x, y, surface, RectTEMP, DDBLTFAST_DONOTWAIT Or DDBLTFAST_SRCCOLORKEY
RectTEMP and surface pertain to the surface with the ground tiles on them.
Is this all correct? i am getting an error at the set Ground = DDraw.CreateSurface(ddsurf2)
Squirm
11-03-2001, 05:06 PM
You must specify the width and height when creating a regular surface (not from file) and also have the WIDTH and HEIGHT flags set.
<pre> With ddsurf2
.lWidth = 640
.lHeight = 480
.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
.ddsCaps.lCaps2 = 0
.lTextureStage = 0
End With</pre>
Xtreme
11-03-2001, 05:23 PM
The code really helped. In the processed i realized a couple of speed problems with my code. by the time i was done i gain 4 or 5 fps. thanks again.
Squirm
11-03-2001, 05:31 PM
Glad to help, anytime images/icons/smile.gif