FUNDAMENTALS OF GAME DESIGN, SECOND EDITION
One-Dimensional Input Devices
One-dimensional input devices send a single value to the game. Ordinary controller buttons and keys send binary values; knobs, sliders, and pressure-sensitive buttons send analog values.
A controller button or a keyboard key sends a single binary value at a time: on when pressed and off when released. Despite this simplicity, you can use buttons and keys in a variety of ways:
■ One-shot actions. Treat the on signal as a trigger, a message to the game to perform some action immediately (ignoring the off signal). The action occurs only once, when the player presses the button; to perform it twice, he must press the button again. You might use this to let players fire a handgun, firing once each time they hit the button.
■ Repeating actions. The on signal tells the game to begin some action and to repeat it until it receives the off signal from the same button at a repetition rate determined by the software. You could let the players fire a machine gun continuously from button press to button release.
■ Continuous actions. The button's on signal initiates a continuous action, and its off signal ends it. Golf games use this to give a player control over how hard the golfer swings the club; the player presses the button to start the golfer's backswing and releases the button to begin the swing itself; the longer the backswing, the harder the golfer hits the ball. Some football games allow the player to tap the button quickly to throw a short pass or to hold it down for a moment before release to throw a long pass, with the length of time between a button's on and off signals determining the distance thrown.
Console game controllers feature anywhere from one to about ten buttons. Buttons on the top face of the controller, to be pressed with the thumbs, are known as face buttons. Others, known as shoulder buttons, appear on the part of the controller facing away from the player, under the index fingers. Faced with large numbers of buttons, the player can find it quite difficult to remember what they all do. Here, as elsewhere, be sure to maintain consistency from one gameplay mode to another, and if an
industrystandard has evolved for your game's genre, do not depart from it without good reason.
Personal computer keyboards have 110 keys, allowing for very broad user interfaces indeed. Be sure to assign actions to keys in such a way that the letter printed on the key becomes a mnemonic for the action, for example, F for flaps or B for brakes. Players themselves can, if you implement the feature, assign actions to keys, so they don't have to select those functions with mouse clicks.
KNOBS, SLIDERS, AND PRESSURE-SENSITIVE BUTTONS
A slider is a small handle that moves along a slot in the controller, which constrains its travel. It returns an absolute position and stays where the player puts it. You find sliders usually used as adjuncts to joysticks for flight simulators; the slider controls the throttle for the engine, letting the player set his speed and leave it there.
A few controllers, such as the Nintendo GameCube controller, include analog pressure-sensitive buttons that, instead of transmitting a binary on or off value, send a number that indicates how hard the player presses. This gives the player a finer degree of control than an ordinary binary controller button. The trigger buttons on the Xbox controller also return analog values. You can think of them as spring - loaded sliders that return to a zero point when released.
Like global positioning systems, compasses are mostly useful for augmented reality games played outdoors. A digital compass returns a single numeric value, the direction in degrees that a handheld device is facing with respect to true north. If the player holding it turns the device in a different direction, the compass detects it. Later versions of the Apple iPhone include a compass.