• Advertisement

Archived

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

Optimize DirectDraw

This topic is 5991 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

// Yaking on Hi I have been learning DirectDraw 7 for about a week now. My first time ever learning graphics prgramming. I am so excited , because since I was 2 or 3 I have wanted to make a game. So now I am 15 & I started making a game. I am real proud of it. // Question It is a tiled base game. Which has cool AI. The AI knows the rule of the world & can work by itself , you just place it anywhere in the middle of the level. So I made a class where it had a function which found out the players health & points . & decide on how much of a beating he needed. It then dynamically made bots using the new & delete opertors. The bots were actully created but were not shown on the screen. SO I guessed that , since I am using a performance counter , which calls render frame function. In render frame function it makes the tiles plus the player, & enemy. So I am guessing that BLTFAST was not able to blt it to the backbuffer quick enough. Is there anyway I could optimze my code so that the bots & player can be shown on the screen. Anything please thanx in advance WizHarD sorry about dodgy writing I am in a hurry

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I don''t quite understand what you mean, but it sounds like the problem is that you just aren''t rendering the bots.
Send a copy of the code to drakonite@yahoo.com and I''ll take a look and see if I can figure out what''s wrong with it for you.
Like most programming mistakes, it''s probably something small and simple... I know I make enough of them...

Share this post


Link to post
Share on other sites
I got it working , I can get up to 7 bots on the screen with a frame rate of 9fps. On my computer which is preety old its quite good. My computer is a K6 500 Mhz with a S3 Savage 4 16 mb. But 9 fps is preety crap. The bots aren''t slowing the game down because if I change the bots to 1 bot I still get 9 fps. Is there anyway I can improve my code. My primary & back buffer surfaces use videomemory. My engine is 16 bit , with 640x480 resultion. I use a performance counter for my game. Everything in the game is object & the player & enemy are object orientated. Should I use register varibles , to speed it up . I don''t mind anything to speed up the game
thanx in advance WizHarD

Share this post


Link to post
Share on other sites
Hmm, 9fps in 16bit and in a 640x480 screen is pretty crap indeed .
Since you are working on a tile based game, I presume you are using something like a map to represent your world. Now, it''s the idea that you don''t draw your entire map all the time, but only that piece of the map that is currently visibile. If you have a small map, blitting the entire map isn''t so bad. But when your maps get larger it can really decrease your performance.
If you''ve already done this, than the problem will probably be somewhere else (duh!). If so, try to explain more what exactly you are doing.

Share this post


Link to post
Share on other sites
Wow. you should be getting more than that. You are probably
doing something thats killing you frame rate. Find and fix
that little problem and your frame rate will probably go form
anywhere from double to quadurple without a problem. Your system
should still be a tile crunchin machine. It might not run
Tribes2 but an oldskool tile engine shouldn''t be to much for
it.

Share this post


Link to post
Share on other sites
Thanx guys for replaying. I managed to get from 9 -> 12 fps. There was a vast diffrence. What I did was changed the surfaces from just using video memory to just using system memory.
About the tiles .My game is a bit of dodgy way of doing tiles. It only has 3 tiles in the whole game each being 400 pixs width & 480 height.
When you scroll the backrounds just move. Then later on I will draw somebuildings & using a parallex I will clip them onto the screen. But at the meoment I have not done that yet.
What sort of frame rate should I be looking for , so I know when to stop changing stuff
thanx in advance WizHarD

Share this post


Link to post
Share on other sites
I can''t say for sure what you should expect with your equip but
I would think that you should be getting at least twice what
your getting. Go to the store and look at the value software
section. right now Best Buy has some great deals like
fallout 1&2 for $10. The reason I recomend it is have a look at the needs for some older games that are doing what you are
trying to do. Run some of your old games. That is what you should
expect. Maybe not expect, but it is what is possible. Games like
fallout and B. Gate were content with a 133-166 CPU, you have
500Mhz. If your not in the same ball park something is still
wrong. Your 3 large tile thing makes me wonder if there is
too much "Am I on the screen?" cheaking going on but maybe not.
someone else might have to help you there. I''m better at basic
ideas, not so hot at the tech issues.

Share this post


Link to post
Share on other sites
If you are working with system memory surfaces, the best thing you can do is move all your graphics to system memory and create a ''fake'' backbuffer on system memory. Compose your scene on this fake backbuffer and when all is finished, copy the scene to the real backbuffer and wait for the vblank for flipping the surfaces.

The reason is that moving data from video to system and system to memory can greatly reduce your performance. it is better if you do so only once per frame. I do it and keep a good 60fps (640*480 8bpp) or at least 40fps (1024*768*8bpp) full effects (but using my own blitting lib).

Good luck
Guimo

Share this post


Link to post
Share on other sites

  • Advertisement