Preface - About This BookApple Game Sprockets is a set of libraries that enhance your ability to create games for the Macintosh or any computer running the Mac OS. This book introduces you to the features of Apple Game Sprockets and helps you get started programming games in a new and easier way. This book contains four chapters, each corresponding to one of the four libraries that define the Apple Game Sprockets.
The four libraries in Apple Game Sprockets are SoundSprocket, DrawSprocket, InputSprocket, and NetSprocket. These libraries offer games developers several advantages over existing approaches to game development.
Apple Game Sprockets alleviates the burden of tedious common details and allows you to concentrate on developing the game play.
- SoundSprocket offers new technologies for presenting sounds localized in 3D space.
- DrawSprocket provides safe ways to manage the display and manipulate graphics, replacing the undocumented methods currently in use. It provides a consistent user experience for configuring game play. It also makes page flipping--long a capability of Apple hardware--accessible to games.
- InputSprocket provides a consistent user experience for configuring how input devices work with games.
- NetSprocket offers a common user interface for hosting and joining network games. Messages are sent and received across a variety of protocols with a simple programming interface.
Developers of input devices also benefit from Apple Game Sprockets. Apple Game Sprockets lets you concentrate solely on providing access to the device while leaving plenty of room for differentiation and adding value.
You can use the four libraries independently or together, as your game requires. These libraries are delivered to the end users as system extensions, similar to QuickTime or OpenDoc. For example, if your game requires the SoundSprocket library, you can include it as a system extension with your game. Apple Game Sprockets may be used without a license fee and the SDK and runtime libraries are available on Apple's Web site.
These libraries are useful in non-game applications as well. You could use SoundSprocket in a sound-effects processing program and DrawSprocket in applications, such as presentation applications, that need to take over the screen--particularly if animation is involved. Applications with simple networking needs could benefit from NetSprocket. InputSprocket could be used for handicapped-access devices.
SoundSprocket OverviewSoundSprocket is defined in the interface file SoundSprocket.h. Its system extension is named SoundSprocketLib. SoundSprocket provides real-time, 3-D spatial filtering of sounds. You can use SoundSprocket to make a sound appear to emanate from its sound source on the screen. For example, a sound can appear to move from left to right or move closer to the user as its source moves.
SoundSprocket can simulate the Doppler effect, distance attenuation, environmental reverberation, and position in space. Your game does not need to know whether the sounds you want to play are being filtered with hardware- or software-based methods.
SoundSprocket uses a virtual audio environment to help you create the spatial sound effects you want. A user's position and possible movement can be defined in a listener so you can filter the sound appropriately. One or more sound sources can also be defined so you can manipulate each source's location and possible movement in detail. SoundSprocket provides a localization component to handle the 3D filtering as the user is playing your game.
SoundSprocket provides both high-level and low-level interfaces for managing 3D sound filtering. The low-level interface provides a message interface to 3D localization sound components. The high-level interface provides a collection of functions that help you fill in the messages that you send to the 3D localization sound components. The high-level interfaces are integrated with, but don't depend on, QuickDraw 3D.
DrawSprocket OverviewDrawSprocket is defined in the interface file DrawSprocket.h. Its system extension is named DrawSprocketLib. DrawSprocket allows you to take over the screen, customize it to best fit your game's content, and display graphics at cinematic frame rates.
With DrawSprocket your game can easily configure the display, taking advantage of any special display features of the system. You don't need to worry about the system meeting the display needs of your game--any features not directly supported in hardware are emulated by software.
A blanking window cuts through any problems you may have had in hiding the desktop during game play. After you configure the display and are ready to begin play, DrawSprocket completely hides the desktop, menu bar, and other system resources and changes the monitor to the best resolution and pixel depth, giving your game a clean slate. When the game's over, DrawSprocket automatically restores everything to its former state.
DrawSprocket provides double buffering or triple buffering and gamma fading to make your game animations smooth and transitions seamless. Double-buffering is a way to emulate page flipping. If page flipping is available on the hardware, DrawSprocket can provide transparent support for it. Gamma fading achieves a non-linear fade so that bright colors don't remain visible after dark colors disappear. It also allows you to fade out to other colors besides black.
Other DrawSprocket features allow you to provide overlays and underlays, use pixel scaling, set a maximum frame refresh rate so your game runs at a constant speed, and easily manipulate colors in a color lookup table. During development, you can use the special debugger feature to keeps system resources visible, even behind the blanking window.
InputSprocket OverviewInputSprocket is defined in the interface files InputSprocket.h. Its system extension is named InputSprocketLib. InputSprocket makes it easy for your game to synchronize itself with existing input devices, configure input devices, and track data from input devices.
With InputSprocket, you no longer have to emulate a joystick on the keyboard or mouse. The device drivers will give standard information about device controls. This makes it easy for games to configure control options. InputSprocket's input device architecture greatly simplifies interactions between games and input devices.
InputSprocket bases the communication between your game and an input device's controls on elements. Elements are the information that describe an input device's controls, such as its axes, thrust levers, buttons, and direction pads. During game play, the game automatically determines the state and transitions of the elements through polling or a simple event queue without using
NetSprocket OverviewNetSprocket is defined in the interface file NetSprocket.h. Its system extension is named NetSprocketLib. NetSprocket provides high-performance data transmission between players that is simple to implement, allowing you to concentrate on the information you need to communicate between players rather than on the low-level details of networking.
The high-level networking functionality makes message routing transparent to the application and lets you specify best-effort or guaranteed message delivery depending on your needs. The protocol-independent model supports multiple transport protocols, such as AppleTalk, TCP/IP, and serial interfaces, based on Open Transport. The TCP/IP protocol allows game play across the Internet.
NetSprocket also handles fault-tolerance--a critical component of any network game architecture. NetSprocket automatically adjusts to the disappearance of a player due to game application crashes or network failure.
You can use NetSprocket's human interface for hosting and joining games or you can develop your own, using NetSprocket as a model. Also, NetSprocket automatically keeps track as players join or leave a game, updating its routing information and informing the other players of changes to the list of game participants.
- SoundSprocket Overview
- DrawSprocket Overview
- InputSprocket Overview
- NetSprocket Overview
- Format of a Typical Chapter
- Conventions Used in This Book
- Special Fonts
- Types of Notes
- Development Environment
- For More Information
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help