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 Responses to “alt+tab works again”

  1. snow says:

    oooh. have you gotten the pre-order/beta system worked out then?

  2. owlmanatt says:

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

    Does this mean no OS X version?

  3. Benji says:

    ahhh, beta is such a good word.

  4. Wouter Lievens says:

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

  5. Mr P says:

    Alt-Tab = Work Friendly :)

  6. BuschnicK says:

    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…

  7. cliffski says:

    I’m doing it manually, what’s RAII? thats new to me…?

  8. Liam says:

    I think I am a little inpatient today :) please feel free to delete the other entries, here is the link I was looking for http://legalizeadulthood.wordpress.com/2009/01/11/direct3d-programming-tip-3-use-smart-pointers/

  9. amishmonster says:

    Great news, on both the alt-tabbing and the prospect of a beta!

  10. Ahmed says:

    I stand ready to beta test the mac version! Either that or I’ll just boot up Windows…

  11. Alt-Tab says:

    That hurts….

    But seriously, I can’t wait to play this.

  12. Spirit_of_snagga says:

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

  13. Arowx says:

    Great work I just found myself trying your Buy button to see if I could pre-order! ;o)

  14. Kerensky says:

    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.