In my previous columns, I've explained the nuts and bolts of handheld computers, and given evidence that worthwhile games are possible, and even profitable, to write for them. My view was most happily supported yesterday when I viewed packaged, commercial games for Windows CE on the shelf of my local Comp(body-cavity-search-before-exit)USA. In this two-part tutorial, I plan to show you what's involved in creating the basis for a platform/Sierra-style game for Windows CE. Note that I won't be handing over to you a finish product, but I do hope to do enough to guide you on the way. What I do intend to show you is how Windows CE differs from the other flavors of Windows, the basics of using the tools, some simple graphics effects, and some storage advice. I’ve included sample code and a demonstration game, which is part of an archive that accompanies this article.
Same Stuff, Different Day
First I must explain the title of this tutorial. Recently, I received a very special birthday present; the boxed set of the HBO miniseries "From the Earth to the Moon." In the final episode, Tom Hanks shares the tale of the first George Lucas; a Frenchman named George Melies. He was the first to do complex special effects, 70 years before there was anything known as Star Wars. With the current release of Episode 1 of that more recent saga, I felt the reference appropriate. For, in developing for handheld computers, we return to the early days of computer entertainment. Thus far, the most advanced of these machines are the 640x480 by 256 color and 16MB RAM HPC/Pro machines. In other words, machines about as advanced as the 386s that were state-of-the-art on desktops almost a decade ago. Once again developers face the joys and troubles faced by early game developers, such as limited memory, slow displays, limited graphics capabilities, but also the one-man development "team" who does it all. But, unlike the 386 era, the handheld developer will also have access to the same tools used by developers of games for Pentium systems. And before you pooh-pooh the idea of being able to make revolutionary, ground-breaking, or even simply profitable games for Windows CE, keep in mind that you still have more computing power in the palm of your hand than the entire multi-billion dollar computer systems which made possible a voyage... from the Earth to the Moon.
Getting Started
The basic tool of designing games for Windows CE is still the Visual C++ IDE. Add to this the Handheld and/or PalmPC SDK. The SDK is in two parts; one part downloadable and upgradable from the Microsoft developer web site, and the other you have to pay for, which includes the actual compilers for each cpu supported. Installation of the SDKs is rather straightforward and simple; just be sure of the directories you wish to use. You’ll probably require the standard Win32 directories, combined with the x86, mips, sh3, and other cpu-specific include and library directories, possibly the DirectX directories (if you do Windows 9x development), and the emulation environment. As you can see, specifying the directories to find the include files, libraries and source files can become confused.
To developer for Windows CE using the Visual C++ IDE, you'll also want to be running Windows NT, if possible, rather than Win9x. The reason for this is that the Windows CE emulation requires Windows NT to run, because Windows CE is more compatible with Windows NT than Windows 9x. For example, Windows CE only supports Unicode strings. Even though Windows 9x doesn't support the emulation environment, you can still develop for Windows CE on a Windows 9x machine – you just have to export your executable to a Windows CE device to test.
Once you have the IDE and SDKs installed, it's time to organize the project. Visual C++ allows you to organize multiple projects into a single workspace, which works out conveniently for handheld development. It also includes a "wizard", which takes you through the steps require to create a skeleton on which you will hang your program.