When to render in DX9

Started by
4 comments, last by TomKQT 13 years, 7 months ago
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?
Advertisement
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.).

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

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.
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.
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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

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).

This topic is closed to new replies.

Advertisement