Sign in to follow this  

When to render in DX9

This topic is 2668 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'm making a topdown 2d tile game.


Since the tiles are static. When the player is not moving, the only thing that needs to be updated is the player model (which is only every 0.15s).

Is there any reason I should let this run at 60fps? Or would it be more effective for me to have a bool that gets set whenever I need a screen redraw?

Share this post


Link to post
Share on other sites
Quote:
Is there any reason I should let this run at 60fps? Or would it be more effective for me to have a bool that gets set whenever I need a screen redraw?

If you only need to change the screen 6 times a second, no need to draw it any more often than that, unless, as you say, there's some other reason to update the screen (another window was on top and has been moved, etc.).

Share this post


Link to post
Share on other sites
How often does it happen that the player isn't moving. If it's not often, there's not much point in switching down. If it happens a lot, well, I just have to wonder what kind of game that is. :)

If you're just looking to optimise when the game is idle, for a small power saving perhaps, then you can reduce the refresh rate, if you want. If the game can be run in a window, that's something you'd also do when the window is not in focus, so you should be able to use the same code.

Share this post


Link to post
Share on other sites
You could only redraw the areas of the screen that have been changed since the previous frame. In many 2D games this will give a much larger performance boost (since you don't redraw the whole thing cause one thing moved a few pixels, and you can have animated stuff) and if there really is nothing changed, then you will have no dirty region to redraw.

Naturally the buffer your drawing onto must be maintained between frames (eg not a back buffer with D3DSWAPEFFECT_DISCARD). For example you could use D3DSWAPEFFECT_COPY.

Share this post


Link to post
Share on other sites
Quote:
Original post by mhagain
I'd be inclined to just let it run at 60fps, and the main reason why is that it will keep your code simpler, which will greatly help when it comes to debugging and future modification.


And it won't hurt anyone. If the graphics is simple and you'll use VSync (to make those 60 FPS), you won't stress your GC (simple graphics) nor your CPU (will wait for vsync anyway).

Share this post


Link to post
Share on other sites

This topic is 2668 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this