Microsoft Windows CE Toolkits Platform Information
Backgrounder
The customized Microsoft® Windows® CE operating system-based environment created for the Sega Dreamcast system brings, for the first time, the benefits of a powerful, robust and flexible operating system to the world of console game development. The size and performance of Windows CE and DirectX® API components are optimized to meet the demands of game developers, while maintaining compatibility with the widely accepted Win32® API and DirectX programming model. Games written for Windows CE on the Dreamcast system can be ported with relative ease to Windows 95, and vice versa, significantly reducing development costs and time to market. Windows CE enables true cross-platform development, freeing programmers from the need to understand every nuance of the underlying hardware while providing high performance, a comprehensive set of APIs, Internet connectivity and a world-class development environment.
The use of a true operating system for game development is a natural response to the need to create increasingly complex games for increasingly complex and diverse hardware. The traditional practice of programming the hardware directly is expensive and time-consuming, effectively requiring developers to create a new, special-purpose operating system for each new game. Using proprietary tools and libraries supplied by console manufacturers, while helpful, still results in games that are tied to a single hardware platform, making them difficult to port.
The Windows CE operating system with DirectX services provides the next logical step - a complete game development platform that is defined in software terms. While developers for Windows CE must understand the capabilities of the underlying hardware, they need not understand how those capabilities are implemented. They simply make use of the services provided by the operating system, which bears sole responsibility for knowing how to use the hardware to provide those services (see Fig. 1). Windows CE and DirectX relieve game developers of the need to write low-level code to provide basic services, allowing them to focus more effort on the games themselves.
The Benefits Of A Software-Based Platform
A key benefit of a software-based platform is a measure of hardware independence. A Windows CE-based game can, with relatively minor modifications, be ported to the Windows-based PC platform because of support for Win32 and DirectX APIs (see Fig. 2). In addition, Sega will be free to revise, enhance and cost-reduce its hardware to a degree that would not be possible if it were required to maintain compatibility with previous hardware at the register level. Furthermore, since Windows CE closely resembles Windows 95 from a game programmer's point of view, experienced game developers for Windows 95 can develop games for Dreamcast almost immediately, using familiar APIs and development tools. For the first time, developers will be able to move freely between console and PC development.
Software-based platforms can offer readymade solutions for common software development problems. The Windows CE-based adaptation of DirectX supports features such as Internet lobbies, lighting, transformation, rendering of texture-mapped polygons and 3-D sound. Having such a broad foundation on which to build games frees programmers to concentrate on features that are specific to the game at hand, resulting in substantial productivity gains.
Even programmers who choose to substitute their own custom components for all or part of DirectX can benefit from the many services offered by the Windows CE kernel and file system. These services include the following:
- Virtual memory management, which all but eliminates memory fragmentation
- Memory protection, which prevents games from crashing the operating system
- CD file management, including asynchronous file loading and file enumeration using wildcards
- Dynamic link libraries, which allow both code and data to be loaded, linked and unloaded at run time and under program control
- Multithreaded event synchronization, which allows threads to lie dormant, consuming no CPU time, until an event occurs. Events can be signaled by other threads or by the operating system.
The financial benefits of a software-based platform are also essential to the importance of Window CE, especially in the current games climate. Cross-platform development and its promise of amortized costs are rendered little more than a dream by incompatibilities between hardware platforms and their associated development environments.
Because Windows CE for the Dreamcast system supports a substantial subset of the Win32 and DirectX APIs, it is compatible with a software specification that already enjoys wide acceptance and extensive support. The resulting ease with which Windows CE-based games can be ported to Windows 95 makes true cross-platform development a reality. This, in turn, can result in increased profitability, due to reduced cross-platform development costs and shorter development times. Porting a Windows CE-based game to Windows 95 can also reduce the financial risk of console game development by creating an additional revenue stream with relatively little effort, thus mitigating the large upfront costs associated with participation in the console game market.
These benefits, combined with continual improvements in hardware performance and market pressures to reduce cross-platform development costs, make the introduction of hardware-independent system software into the world of game development inevitable. Indeed, the appearance of such software is merely the next step in an evolutionary process that has a considerable history.
Early game consoles, such as the Atari 2600, were programmed exclusively in assembly language, there being no other way to achieve the required performance while fitting an entire game into 2 KB or 4 KB of ROM. As game consoles became more sophisticated and hardware performance improved, the use of high-level languages such as C and C++ became widespread.
In a sense, the use of a compiler represents the introduction of a layer of software between the programmer and the hardware, generally resulting in code that is slightly larger and slower than hand-coded assembly language. Even so, developers routinely pay this price in return for the benefits afforded by the use of high-level languages, such as shorter development times and freedom from the need to learn a new assembly language to program a new processor. The performance of the Dreamcast system makes the cost of these benefits bearable.
Design Goals And Strategies
The goals of Windows CE for the Dreamcast system are to provide game developers with a development platform that achieves the high performance and small footprint demanded by game console hardware, while providing a comprehensive set of services and sufficient hardware independence to greatly simplify cross-platform development.
Windows CE also aims to introduce console game developers to a more extensive and sophisticated suite of development tools than have previously been available to them, including a full-featured integrated development environment, offering a choice of emulation on the PC or remote debugging on the Dreamcast hardware.
A Streamlined Version Of Windows CE
Windows CE was designed and written to provide high performance on inexpensive hardware. Although compatibility with the Win32 API has been maintained, Windows CE shares no code with Windows 95. In addition, Windows CE for the Dreamcast system has been further optimized for game development and for Dreamcast-specific hardware.
- The conventional Windows graphics device interface (GDI) has been largely eliminated; all output to the screen is performed using DirectDraw® API-based surfaces.
- All Windows CE-based games run in full-screen exclusive mode, which allows numerous other features of Windows to be discarded, such as multiple overlapping windows, the rendering of window frames and window focus management.
- Windows CE for the Dreamcast system eliminates the Windows desktop and the standard Windows user interface objects, such as buttons, list boxes and dialog boxes.
- The Windows CE file system makes extensive use of Dreamcast's Direct Memory Access (DMA) capabilities.
- Windows CE supports multiple processes and multiple execution threads, but all processes share a single virtual address space, which streamlines interprocess communications. Games are prevented from corrupting another process' memory through the use of page protections.
An Optimized Version Of DirectX
The Windows CE-based version of DirectX for the Dreamcast system is streamlined and optimized to a greater degree than is possible in the diverse PC hardware environment, making it smaller and faster than the PC version. On the PC, DirectX must be able to tolerate a wide variety of features and performance in the hardware on which it runs. Performance must degrade gracefully on slow machines. Operations that are not supported in hardware must be emulated in software.
By contrast, the Dreamcast version of DirectX takes advantage of intimate knowledge of the features and performance of the Dreamcast hardware.
- The rendering functions of the hardware emulation layer (HEL) found in the PC version of DirectDraw have been eliminated. All rendering functions are performed by the Dreamcast hardware.
- Performance-critical sections are written in the assembly language of Dreamcast's CPU, the Hitachi SH-4.
- The Direct3D® API code takes advantage of the SH-4 store queue, as well as SH-4 machine language instructions that perform vector and matrix operations.
- The DirectSound® API supports Dreamcast's hardware mixing and QSound capabilities.
- The DirectPlay® API implements a lightweight, client-only version of TCP/IP and is optimized for the Dreamcast modem.
- All parameter validation code has been removed from the retail version of DirectX, though parameter validation is still performed in the debugging version.
The memory footprint of DirectX is further reduced by its modular design. Components not required by a particular game (e.g., Internet communications or Direct3D) need not be loaded.
Dreamcast-Specific Extensions
Microsoft Corp. is committed to supporting all of the hardware capabilities of the Dreamcast console through Windows CE with DirectX. Where these capabilities extend beyond the scope of the standard Win32 and DirectX APIs, extensions and customizations are being provided, including support for the following hardware features:
- Nonvolatile RAM cards that plug into Dreamcast game controllers
- Differences between Dreamcast and PC graphics paradigms, with respect to the clearing of frame buffers and the sorting of transparent polygons
- Effects volumes, which can be used to confine graphic effects to arbitrary regions of 3-D space
- Bump maps
- VQ texture compression
- Sound capture using the Dreamcast microphone
Windows CE Components
Windows CE for the Dreamcast system consists of a 32-bit, multitasking, multithreaded operating system, overlaid with a set of DirectX 5.0-compatible components. The basic components are diagrammed in Figure 3. Game development is supported by the Windows CE and DirectX SDK, a comprehensive suite of development tools built around the Microsoft Visual Studio® development system version 5.0, one of the most sophisticated and full-featured development environments available for any platform.
The Operating System
The Windows CE operating system kernel supports pre-emptive multitasking and multithreading with priority-based scheduling. Thread synchronization is supported using a subset of the standard Windows synchronization objects. The number of processes is limited to 32, but the number of threads is limited only by available memory.
Windows CE-based device drivers support a subset of the Windows Driver Model, as implemented in the Windows NT® operating system version 5.0, and are optimized for the Dreamcast hardware.
Communication with remote machines via modem is supported through the Windows Serial Communications API. Communication over the Internet is supported through a subset of the Windows Socket and RAS APIs, providing TCP and UDP sockets and PPP dial-up support.
The size of GDI and USER APIs are drastically reduced. They support loading and copying bitmaps, rendering text to bitmaps or DirectDraw-based surfaces, input and message handling, string resource loading, and the rectangle APIs. Other GDI and USER functions, such as overlapping windows, cursors and focus management, have been eliminated.
DirectX
Windows CE for the Dreamcast system provides a full range of services by incorporating the following most popular portions of the DirectX API:
- DirectDraw, which supports 2-D graphics and low-level buffer management
- Direct3D, which supports 3-D lighting, transformation and rendering
- DirectPlay, which supports communications over modems and the Internet
- The DirectInput® API, which supports game controller input
- DirectSound, which supports digitized sound output
- The DirectShow!" API, which supports playback of video files
DirectDraw is the sole means of graphics output within DirectX; all rendering is performed to DirectDraw surfaces. DirectDraw supports the rendering of 2-D graphics and manages the allocation and swapping of the surfaces to which it draws.
Direct3D is tightly integrated with DirectDraw and provides a hardware-independent means of modeling, transforming and rendering 3-D objects, without sacrificing the benefits of hardware graphics acceleration. For Windows CE, Direct3D means Direct3D Immediate Mode. The Direct3D Retained Mode component found on the PC is not supported. Direct3D Immediate Mode supports lighting, transformation and rendering of 3-D primitives such as points, lines, triangles and triangle strips.
The Windows CE-based version of DirectPlay offers console developers access to substantially the same level of Internet communications services that PC developers enjoy. DirectPlay for Windows CE is a subset of DirectX 5.0, supporting communications via peer-to-peer modem connections or TCP/IP. Support is provided for Internet lobbies in a manner that gives game developers complete control over a lobby's user interface.
DirectInput provides interfaces to Dreamcast's input devices, such as joysticks.
DirectSound provides access to Dreamcast's sound hardware in a manner that is consistent with the Windows-based versions of DirectSound and that takes advantage of specific features of the Dreamcast sound and music hardware, such as QSound.
DirectShow allows games to play AVI files that have been encoded with the Truemotion2 codec, as well as MPEG1 video files.
There is also an API to access nonvolatile memory, which is provided via RAM cartridges that plug into the Dreamcast game controllers. This memory may be used for storing small amounts of information that must survive from session to session, such as simple saved games, players or levels.
Customizing The Configuration
Many Windows CE components are optional and may be omitted when their functions are not required or to substitute custom components. In its minimal configuration, Windows CE consists simply of a kernel, providing support for processes, threads, interrupts and memory management; a file system, allowing files to be read from the CD; and support for the Windows CE device driver architecture. This configuration eliminates the Windows messaging system, the C run-time library, Internet communications, and all of DirectX, including the graphics device driver.
Beyond this minimal configuration, programmers may choose which components to include, with few interdependencies. DirectPlay requires Windows Socket, DirectShow requires DirectDraw and DirectSound, and DirectDraw and Direct3D have been integrated into a single component. Beyond that, programmers may use whatever combination of components suits their needs. (Replacing DirectX components with custom components requires programmers to write code that accesses the hardware at a lower level than would otherwise be necessary with DirectX.)
Development Tools
The development tools provided with the Windows CE and DirectX SDK are built around the Microsoft Visual Studio development system 5.0. This not only allows programmers for Windows to develop games for Windows CE for the Dreamcast system without having to learn a new suite of tools, but also allows programmers from the console arena to discover the benefits of the same powerful integrated development environment (IDE). The productivity and convenience features offered by the IDE are numerous. Following is a sample:
- A customizable, syntax-aware editor
- An optimizing compiler, which automatically links error messages to the spot in the source that caused the error
- Source-level debugging, using a choice of emulation on the PC or remote debugging on the target hardware
- Windows that allow simultaneous viewing of any combination of source code, watch variables, the function call stack, memory, registers and disassembled machine code
- Symbolic browsing of C++ classes
- The ability to examine a variable's value simply by holding the cursor over it in a source window
- The ability to set a watch variable by dragging a variable name from a source window to a watch window
- The ability to go directly to the definition of a constant, variable or function by clicking on any reference to it. This works even for symbols that are defined outside of a project, as long as the appropriate source files are available.
- Extensive online help, including descriptions of every API call and every compiler and linker error
Compatibility With Windows 95
While Windows CE is a member of the Win32 family, there are a few compatibility issues between Windows CE for the Dreamcast system and Windows 95, resulting from the smaller size and more modern origins of Windows CE.
- Text files use UNICODE exclusively to facilitate localization to areas outside the United States. Programs may not assume that the size of a character is one byte.
- The smaller size of Windows CE means that it supports fewer Win32 and DirectX API functions than Windows 95.
- Dreamcast has no hard disk drive.
- Dreamcast is limited to 16 MB of RAM. While this is sufficient for many PC games especially considering the reduced memory footprint of Window CE), a growing number of PC titles require more than 16 MB.
It will generally be easier to port a game from Windows CE on the Dreamcast system to Windows 95 than vice versa. Still, porting from Windows 95 to Windows CE will be substantially easier than porting to a console environment that supports a fundamentally different programming model.
Summary
The Windows CE operating system is a full-featured, full-service operating system, yet its optimizations for game development in general, and the Dreamcast hardware in particular, make it a sound choice for serious, high-performance game development. Windows CE is a direct descendant of operating systems (Windows NT and Windows 95) that have achieved wide acceptance and spawned powerful and feature-rich development tools.
The Windows family of operating systems has proven over the years that it is generally useful for the development not only of games, but of the widest possible range of personal computing applications. This places Windows CE in a uniquely advantageous position to branch out beyond pure games into other recreational applications such as Web browsing and e-mail.
Windows CE promises to create a leading software-based game development platform that bridges the gap between the Dreamcast console system and PC game development, and increases the efficiency and profitability of game development by allowing developers to program for multiple hardware platforms while having to learn only a single software platform.
The information contained in this document represents the current view of Microsoft Corp. on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.
Microsoft, Windows, DirectX, Win32, DirectDraw, Direct3D, DirectSound, DirectPlay, Visual Studio, Windows NT, DirectInput and DirectShow are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners.
Last Updated: 7/15/99
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.