Game Development Reference
In-Depth Information
n Two-axis controllers: A mouse and joystick are 2D controllers. Their status can
be represented as integers or floating-point numbers. When using these devices,
you shouldn
t assume anything about their coordinate space. The coordinate
(0,0) might represent the upper left-hand corner of the screen, or it might
represent the device center.
n Three-axis controllers: This would be typical of an accelerometer in a Wii-style
controller or smart phone. The status is typically represented as a three-
dimensional vector of floating-point numbers.
n Others: There are more controllers and input devices out there, such as
gyrometers, microphones, cameras, multitouch screens, GPS devices, and more.
'
Game controllers, even complicated ones, are typically built from assemblies of these
component types. The tricked-out joysticks that the flight simulator fans go for are
simply buttons and triggers attached to a 2D controller. A Wii Remote has multiple
buttons, a trigger, and an accelerometer. To support these devices, you need to write
a custom handler function for each component. Depending on the way your handler
functions get the device status, you might have to factor the device status for each
component out of a larger data structure. Eventually, you
'
ll call your handler func-
tions and change the game state.
Choose Controls with Fidelity in Mind
When you choose a control scheme for your game, be mindful of the fidelity
of each control. For example, a gamepad thumbstick has a low fidelity
because the entire movement from one extreme to another is only a few
centimeters. The mouse, on the other hand, has a very high fidelity since its
movement is perhaps 10 times as far. This is a fundamental difference
between games that use the gamepad, where targets are large and few in
number, versus games that require a mouse, where targets require speed
and precision, such as a headshot.
If you attempt to force a gamepad thumbstick into the same role as a
mouse control, your players will be extremely frustrated and likely will stop
playing your game. For games that are gamepad based, the players using
gamepads will certainly need a little help aiming, as do most console shooters such as Halo. The
players still need a high degree of skill, and its design cleverly balances the movement of the AI, the
aiming help, and the control scheme to be fun. Also, don
t think for a second that a game that requires
the precision of a mouse can work on a tablet like the iPad
'
the typical human finger is far from pixel
accurate.
You can create some interface classes for each kind of device that takes as input
the translated events that you received from messages, callbacks, or even polling.
 
Search WWH ::




Custom Search