Delphi Graphics and Game Programming Exposed! with DirectX For versions 5.0-7.0:Input Techniques
Search Tips
Advanced Search
Title
Author
Publisher
ISBN
Please Select
-----------
Artificial Intel
Business & Mgmt
Components
Content Mgmt
Certification
Databases
Enterprise Mgmt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Productivity Apps
Programming Langs
Security
Soft Engineering
UI
Web Services
Webmaster
Y2K
-----------
New Arrivals
Delphi Graphics and Game Programming Exposed with DirectX 7.0
by John Ayres
Wordware Publishing, Inc.
ISBN: 1556226373 Pub Date: 12/01/99
Search this book:
Previous
Table of Contents
Next
CHAPTER 7Input Techniques
This chapter covers the following topics:
Human/computer interaction
DirectInput fundamentals
Retrieving keyboard input
Retrieving mouse input
Retrieving game controller input
An excellent graphics engine is important to the popularity and enjoyment of a game. The sound effects and music that are synchronized to the action on screen are also imperative. However, think of the most enjoyable game youve ever played, and consider what it would be like if you had no way of interacting with the game elements. It would be like watching a movie, at best. How about if you could interact with the game through only a single button on the keyboard, or perhaps with only the movement of the mouse cursor? Your actions would be limited indeed, as would your enjoyment of the game. As with graphics and sound, user input is a vital piece of overall game development that merits serious consideration.
User input functionality is something most developers, and game players, take for granted. Even so, the method by which a game player interacts with the game can have a profound effect on how skillfully the player navigates the games environment, and consequently the overall enjoyment of the game. Some game types naturally lean towards certain types of input devices; flight simulators tend to feel right when played with a joystick, whereas real-time strategy games are usually best played with the mouse. The supported devices allowing the user to provide game input, and how those devices are implemented in terms of how they manipulate game elements, can make or break a game.
In this chapter, we examine various techniques for retrieving user input through a variety of devices. Regular Windows API functions will be briefly touched upon, as our discussion will focus on how DirectInput provides developers with a responsive and powerful interface to any input device available.
Human/Computer Interaction
Human/computer interaction is the concept of how humans and machines, typically computers, interact with one another in a method that is meaningful and intelligible to both. Entire volumes have been written on techniques to make human/computer interaction more intuitive, including both input techniques themselves as well as the presentation of the interface. While the majority of this concept is beyond the scope of this book, certain elements are relative to our discussion of user input techniques.
human/computer interaction: The concept of techniques and methods by which humans and machines, primarily computers, exchange information.
Exactly how user input will be translated into game element manipulation is dependent on the game itself. Flight simulators need input that affects the direction of flight, or perhaps even the selection and use of a weapon. Strategy games, by contrast, need input that determines which token is selected and its direction of movement or combat. These concepts will be accounted for when the game itself is designed. Perhaps the most important consideration for user input is the device by which the user will interact with the machine and, more specifically, the game.
Input Devices
Technically speaking, todays machines have a wide variety of devices by which they can receive input from users. Some of the more exotic input devices, such as speech recognition, are becoming available to the average computer user, and may one day replace many, or all, of the standard input devices currently in use. While it may be a good marketing hook to provide support for some of these more esoteric input devices, all games should provide support for standard input devices found on almost every machine. These standard input devices consist of the keyboard, the mouse, and game controllers.
Keyboard
It would be hard to imagine any computer in todays market that doesnt come with a keyboard. The keyboard has been the standard input device since the dawn of the home PC, and it is safe to assume that it will be available for input when your game is executed. Retrieving keyboard input is easy and very straightforward, and can provide a very intuitive interface for almost any game.
Mouse
The mouse is another standard input device available on just about every machine. While not quite as old as the keyboard, the mouse is just as necessary and probably more important for user input, thanks to Windows. Since our games will be using DirectX, and will thus be restricted to the Windows platform, we can assume that the mouse will be available for input when the game is executed. Retrieving mouse input is almost as easy and straightforward as retrieving keyboard input, and like the keyboard, it provides a very intuitive interface for certain types of games.
Game Controllers
About five years ago, this category would probably have been called simply Joysticks. However, in the recent past, a multitude of input devices has been created that are aimed specifically at providing intuitive input for various games. Rudder pedals, steering wheels, gamepads, throttles, and all manner of sundry and arcane input devices are now available, making some games much more enjoyable to play. Even the standard joystick has become incredibly complex, with many sporting impressive arrays of buttons, switches, sliders, and even tactile responses known as force feedback.
force feedback: A method by which an input device can output tactile feedback to the user through various actuator motors.
Strictly speaking, a game cannot automatically assume that any type of game controller is hooked up to the machine, as game controllers have not yet become a standard input device shipped with new machines. It is good programming practice to provide an alternative form of input in the absence of a more appropriate input device, even if this input interface is somewhat cumbersome or even awkward. Retrieving input from various game controllers is necessarily more difficult than retrieving input from the mouse or keyboard, primarily because of the sheer number and variety of available game controllers. However, if a game lends itself to input from a specific type of game controller, such as a steering wheel for driving games, then the game should provide support for the most appropriately intuitive input device.
Input Considerations
Even though the developer has determined which input devices will be supported and how they interact with game elements, individual users may find this structure somewhat restrictive based on their particular preferences. To accommodate those who feel your perfect interface could use some improvement, it is important to allow the user to change the configuration of input methods to their desired taste, within the structure of the input interface.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.
Wyszukiwarka
Podobne podstrony:
ustawa 07 01 1993oak 07 01 2010 07 01 08 praPlan studiow PK NST nabor2008 09 07 01ZL1 07 01rozp min zdr z 07 01 2004 ws badań lekarskich kierowców ( )konstytucja rzeczypospolitej 07,01,2015EIMP Głubczyce, 07 01 2012więcej podobnych podstron