Archived

This topic is now archived and is closed to further replies.

Slow down, hmm, couple of questions

This topic is 5849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using DirectDraw for the card game I am making. I wondered are GDI functions (TextOut, SetColor, etc,) going to slow it down? I am currently using TextOut to paint text in the game, and it is working fine, but I am a little worried it may slow up my frame rate. 2nd, I am currently blitting bitmaps. First placing a bitmap onto an of screen surface, and then blitting from the offscrean surface onto the backbuffer. 2 questions regarding this: Would my program run quicker with other image formats, perhaps jpegs, or would this have no serious affect? And, I am placing 7 images into 7 different offscrean surfaces. Each image is on average 970 kilobytes in size, with one being 1.5 megabytes. Is this big? Am I using up more memory than I should be if I want it to run well on very average systems? And is this likely to affect or slow down fps? I know this is a relative question, and there is likely no right answer. 3rd the program is running fine on my computer. I am getting 30 fps. Now, when I try the program on my friends computer, we are running awfully slower, at around 10 fps, sometimes less. She also has Windows ME running, and has DX 8, (which is what I am using to code the program), and she has plenty of RAM and processing power, her graphics card is no better, but no worse, than my own. I am trying to figure why the program runs so slow on her system, and fine on my own. Other games, with (I should think, they certainly look much nicer ) higher graphical requirements such as Tombraider 4, run with no slowdown at all on her computer. Anyway, thanks for all responses.

Share this post


Link to post
Share on other sites

GDI functions are relatively slow - and will slow down your application considerably if you make a lot of calls to these functions. I would recommend you implement your own versions of the required GDI functions using DirectDraw methods instead.

Blitting bitmaps... the most common method (I believe) is to have an offscreen buffer, a backbuffer, and your primary buffer (i.e. the screen). This is a method I regularly use. I copy my offscreen buffer to my backbuffer, the offscreen buffer often containing my background image, then continue to draw sprites, text, overlays, etc. to the backbuffer. Once complete I simply blit (or flip) the backbuffer to the primary buffer for display. My offscreen surface is generally the same size as my backbuffer and my primary surface.

You mention that you are placing 7 images of approximately 1MB to various buffers... this is a lot of information to be blitting around if you want to achieve decent and maintainable framerates on all but the most powerful of hardware. The format you use for your bitmaps is really up to you... once they are in memory in the correct format it makes no difference which file format they were in originally. To speed up your drawing you may find it useful to look up ''dirty rectangles'' as a method for displaying your 2D bitmaps/sprites on the screen.

Hope this helps a litte! :-)

Cheers,
Sharky

Share this post


Link to post
Share on other sites
Along the dirty rectangles line of thought, card games frequently go through the game loop a lot of times without changing the screen at all. You might consider having a boolean flag. When a card moves, you set the flag. When you hit the drawing function, check the flag, If it isn''t set, skip right over the drawing code. If it is set, do the drawing code and clear it.

Share this post


Link to post
Share on other sites