Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Also posted on StackOverflow, hope this isn't a problem.


Recently I've been writing a bot for a game which uses a DirectX backend for its rendering. I have managed to 'hack' the game into allowing me to run multiple instances. Unfortunately, this has taken a serious toll on my computer's CPU/RAM usage. I would like to optimize & reduce the amount of resources each instance eats up. Thus, I have a couple of questions:

  • If I stop DirectX from rendering, will this increase performance?
  • How can I do so?

I have a few ideas about how to do this - I'm guessing I can just hook the rendering function and force it to return without doing anything. My question though - will doing so noticeably improve performance?

Any help would be greatly appreciated.

share|improve this question
1  
Regarding cross posting, see this meta thread. –  Josh Petrie Aug 1 '11 at 23:35
    
Oops, sorry. Should I go back and delete the one in StackOverflow? –  Brandon Aug 2 '11 at 1:00
2  
I do hope that this is a single-player game you're talking about, as there are a lot of people who tend to get rather upset about modifying multi-player games, especially for personal gains. –  Lars Viklund Aug 2 '11 at 6:47
    
So you guys downvoted the question because of moral reasons? Not good imo. –  TravisG Aug 2 '11 at 22:40
    
It's a jump-to-conclusions-mat! Correlating commenters with downvotes is a bit far-reaching, particularly when some are physically incapable of downvoting. –  Lars Viklund Aug 3 '11 at 19:19
add comment

1 Answer

up vote 1 down vote accepted

If you stop D3D from rendering -- typically by detouring the D3D calls directly -- you may see an increase in performance. It will depend primarily on whether the application's performance is actually bound by limitations on the GPUs resources.

You may also destabilize the game, which may be making some decisions based on responses it gets from the GPU (for example by using queries) which it will of course no longer get, since you suppressed transmission of any commands to the device. Ideally of course, rendering and game logic are wholly separate, but sometimes this isn't the case.

You'll probably have to do a fair bit of juggling and balancing what you detour. You could, for example, allow all resource creation to succeed so that you don't have to deal with the game not coping with your proxy resources (which may not match its internal validation), but if the problem you're seeing with performance is that you're overloading the resources stored on the GPU, you will not see any benefit from this approach.

If at possible, profile before you commit to a lot of work. Use Resource Monitor to watch system performance counters and be aware of the complexities of profiling the GPU.

share|improve this answer
    
Thanks for the reply. The game is made by a pretty major company so as an act of faith I'm going to trust that their programmers have separated the rendering from the game logic. That said, what would you have in mind as possible causes of a game running slowly or using a lot of resources? Surely a game wouldn't need to constantly run CPU-intensive computations and what-not? (I don't really know what I'm talking about when it comes to this area.) I'll check out Resource Monitor when I get home and see what it reveals. –  Brandon Aug 2 '11 at 1:11
    
When targeting a desktop machine, there's very few reasons why you wouldn't use as much processing power as you can lay your paws on, especially if your game is intended to completely capture your players focus when running. There are of course optimizations that any decent game should do when unfocused/minimized - like handling the messages associated with those events to know when to not render anything or auto-pause the simulation. As for major companies writing better code? Heh. –  Lars Viklund Aug 2 '11 at 6:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.