Alt-tCRASH
Publication date: 20 March 2011Originally published 2010 in Atomic: Maximum Power Computing
Last modified 03-Dec-2011.
Hey, gang! Let's list the things we all expect to see in a bad console-to-PC game port!
Limited graphics options, of course. Poor-to-no control configuration, too. Some idiotic checkpoint game-save system, an installer that tries to downgrade some drivers, DRM so bad you suspect it was created to promote The Pirate Bay... Oh, and no support for alt-tabbing back to Windows!
That last one's a doozy, ain't it? And the weird thing is that you don't just see it in console ports. It shows up in all sorts of games. Even after multiple patches.
You know what I'm talking about. You're playing your new game, everything's great, then someone sends you a Skype message or something and you want to reply so you pause, alt-tab to Windows, and... oh, boy. Now you've done it.
You're looking at a black screen, or you get to the desktop successfully but the game is now some sort of invisible window you can't switch back to. Or it all falls in a heap and you get a "Your program crashed, sucker!" dialog box that you can't click on because the mouse pointer is invisible.
(Solution: Either wave your invisible pointer around clicking blindly until you hit the right button, or ctrl-alt-del, Task Manager, which may make your mouse pointer reappear so you can click the original error-dialog's button. Or you can kill the game process in Task Manager itself, possibly via keyboard navigation.)
You might, fairly, wonder why the hell this still happens.
When we were playing Command & Conquer over IPX/SPX in 1996, we didn't like the fact that pressing one of those new-fangled Windows keys would freeze the game for everyone until, and unless, the unfortunate key-presser managed to switch back to the game.
(If you were born in 1990, and you're wondering why old farts pop Windows keys off the keyboard or superglue 'em solid, now you know.)
But back then, we knew that Windows was just pretty flags and bunting hung on scaffolding made out of DOS. Lousy multitasking like this was par for the course.
Back in the days when "Never Gonna Give You Up" was played unironically on major radio stations, the Commodore Amiga had really, really nice multitasking, including party tricks like letting you grab the top of a program's screen and pull it down, to reveal some other program running behind it. Almost all Amiga games were much worse at multitasking than games on modern Windows PCs, though, because they were written to run on Amigas with 512 kilobytes, or at most two megabytes, of memory, and orders of magnitude less processing power than a modern mobile phone. So most games monopolised the whole system, booting their own bare-bones code from floppy and never loading the main operating system, needed for multitasking, at all.
Every modern personal-computer operating system (Windows, Linux, Mac OS, FreeBSD...) has serious, robust multitasking capabilities. Mainstream Windows flavours have been based on the DOS-free NT kernel since Win2000 came out. So you'd think there'd be no excuse for a program that won't let you switch to some other program, and back.
But the problem is still rampant. If you're playing Peggle, alt-tab works fine. Also, probably, if you're running a "proper" game in windowed mode. Fullscreen is a whole other story, though.
The reason for this is that modern games are the most demanding software that most PCs ever run. And big games need a lot of memory.
So when you run a standard fullscreen 3D game, Windows makes as much room for it as possible. The video-card memory that was being used for the Windows desktop, and the main system memory that was keeping track of all the desktop stuff, is paged out to disk. (Or the data's just dropped on the floor, to be recreated from scratch whenever it's needed again.) This frees up memory - possibly a very important amount of memory, on marginal systems - for the game.
Pretty much everything that was running in the background is still going to be running along with the game, which is why you can receive that deadly Skype message. But the little men inside the computer whose job was making the desktop visible now all have other jobs. They are now handed 3D model and texture data, sound data, and the many other things that the game needs to have on call at a moment's notice, so your game's frame-rate doesn't go to hell every time you turn around.
And then you go and press alt-tab.
The game now has to let go of whatever precious data is taking up Windows-desktop memory. If it does that, you'll be able to switch back to the desktop. If it doesn't, it's black-screen time.
If you want to be able to alt-tab back to the game, the game has to be able to re-fill all of the memory with the stuff that was in it before. If it does that, you'll be able to continue playing. If not, not.
Windows can manage this RAM-shuffling for a game, if the programmers just put all of the relevant data in the DirectX "Managed pool". But this reduces performance and eats more system and graphics RAM, so in practice it's not much use for full-fat games that already make the computer work hard.
If the programmers don't use the DirectX managed pool, they have to write their own code to handle the shuffling. This is not easy to do. Especially if the programmers are making their own game engine, or if they've licensed an engine that doesn't happen to support alt-tabbing well, or at all.
Windows does of course tell a program when the user's trying to alt-tab, whereupon you can be pretty confident that the program will stop playing sound (possibly after every current sound effect has finished playing), and will also stop intercepting input. Both of those things are pretty easy to do. But beyond that, it gets hairy. If the programmers don't use the low-performance built-in DirectX function, then they'll probably need to hunt many strange things down by hand to get alt-tab to work right.
(Note that this also explains why a game may support alt-tab while you're playing, but crash if you alt-tab - or if Some Damn Window pops up and steals focus - while the game is loading. Alt-tab support when the game proper isn't actually running yet is a whole separate thing the programmers have to allow for, and it's likely to be pretty darn low on the priority list as Release Day bears down upon the coding team.)
It's always easy to tell if a game supports the new Interspatial Fourier-Convolution Vertices v11.3 that're the unique selling point for the new nVidiATI RadeForce THX 1138 graphics card. You won't be able to tell by playing the actual game, of course, but this very important information will always be right there on the game's bullet-pointed feature sheet, along with proud declarations of the game's support for Migraine3D monitors, and more information than is readily justifiable about its mediocre original soundtrack.
I hope, one day, to see such a feature list proudly headed by an entry that says "Alt-Tab Bloody Works".