Game Design, Programming and running a one-man games business…

alt+tab works again

For a while i’ve had a problem where alt+tab wouldnt work in the game. I had it working from the main menu, but if you tabbed out mid-battle, it would hang on tabbing back. If you’ve played my older games, you know they always support this easily. I find it annoying when games don’t play well with the underlying O/S, and its often a symptom of a cheap console-port. Nevertheless, the change to directx9 has really complicated matters.

Regardless of this alt+tab works now even mid-battle, no thanks to microsoft. The problem is, you get to a point where you have to call Reset() on the Direct3DDevice. This is fine, and it returns true or false (effectively). If you turn on all the debug output, run with the debug DLLs, and check the debug output at this point you get a message a bit like this:

“Reset failed because you forgot to release a reference count somewhere”.

And the exact piece of code that writes that, knows exactly which piece of your code has its reference count too high, but they don’t bother telling you. Grrrr. In the end I tracked it to me grabbing the render targets surface somewhere (specifically the code that writes fancy layered shield impact effects). If you just grab a surface from a texture, it increases the reference count. Quite why it does this I’m not sure, as the solution is to just call release() immediately.

Anyway, it’s fixed. Several other things are fixed and improved, and the game is looking very playable right now. The actual AI-opponent fleets are not all finished, I need to play through 11 different battles on 3 difficulties, and tweak all those Ai-ships and fleets for a while yet. But then, apart from a few more tutorial things and putting in final music… that will be practically time for a beta.


15 thoughts on alt+tab works again

  1. >Nevertheless, the change to directx9 has really complicated matters.

    Does this mean no OS X version?

  2. Alt-tab working is really essential. My girlfriend systematically interrupts me when I’m on the computer to go and read her emails, so I need to alt-tab :-)

  3. Are you using any kind of RAII system for handling DirectX manual reference counts (yuck!) or are you doing it by hand all the time? I found it nearly impossible to always remember releasing everything when doing it manually. Especially when using exceptions…

  4. It looks very nice ! I can’t wait to see it running. Do you have a date in mind for the release of the beta (I apologize for my english) ?

  5. Pleased to hear it’s coming along, if you want some help with the tutorial I had a few ideas in my head for really making it professional in design and possibly with some quality voice acting too.

    I’m definitely waiting anxiously to pre-order and get in on the beta.

Comments are currently closed.