Gaming

  Home arrow Gaming arrow Controlling Games with the Keyboard an...
Watch our Tech Videos 
Dev Hardware Forums 
Computer Cases  
Computer Processors  
Computer Systems  
Digital Cameras  
Flat Panels  
Gaming  
Hardware Guides  
Hardware News  
Input Devices  
Memory  
Mobile Devices  
Motherboards  
Networking Hardware  
Opinions  
PC Cooling  
PC Speakers  
Peripherals  
Power Supply Units  
Software  
Sound Cards  
Storage Devices  
Tech Interviews  
User Experiences  
Video Cards  
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
GAMING

Controlling Games with the Keyboard and Mouse
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 33
    2004-10-11

    Table of Contents:
  • Controlling Games with the Keyboard and Mouse
  • Taking a Look at User Input Devices
  • Mouse and Joystick
  • Tracking the Mouse
  • Revamping the Game Engine for Input
  • Sprucing Up the Bitmap Class
  • Building the UFO Example
  • Testing the Finished Product

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     

    SEARCH DEV HARDWARE

    Controlling Games with the Keyboard and Mouse


    (Page 1 of 8 )

    There's a name for a game with no user interaction—it's called a screensaver! Learn how a mouse handles input and create a program with an animated graphical object that you can control with the keyboard and mouse. (From the book, Beginning Game Programming, by Michael Morrison, ISBN: 0672326590, Sams.)

    morrisonNote - Defender is perhaps the most popular side-scrolling game ever made, which means that the game play flows sideways across the screen. Defender also shares the distinction of being one of the most difficult classic video games. Created by Williams in 1980, Defender is also unique in that it is one of two arcade games to have grossed more than one billion dollars. Can you guess the other? Pac-Man! Defender is a great example of a game whose controls were so well integrated into the game play that the game took a lot of experience to master. If you somehow manage to master Defender, its sequel, Stargate, is even tougher.

    All the graphics in the world wouldn't save a game if you couldn't interact with it. There's a name for a game with no user interaction—it's called a screensaver! User interaction can come from several different places, but you can generally break it down into a short list of user input devices: the keyboard, the mouse, and joysticks. The keyboard and mouse are, by far, the two most standard user input devices on computers and are just about guaranteed to be supported on all personal computers. Joysticks are also quite common, but aren't nearly as commonplace as keyboards and mouse devices. Therefore, you should consider the keyboard and mouse the two most important game input devices, with joysticks following behind in third place. This chapter focuses on interacting with the user via the keyboard and mouse, whereas joysticks are covered in Chapter 7, "Improving Input with Joysticks."

    In this chapter, you'll learn:

    • Why user input is so important in games

    • How each of the major types of input devices impact games

    • How to efficiently detect and respond to keyboard input

    • How to handle mouse input

    • How to create a program with an animated graphical object that you can control with the keyboard and mouse

    Gaming and User Input

    User input is the means by which a user interacts with a game. Considering the fact that user input encompasses all communications between a player and a game, you would think that designing an intuitive, efficient interface for user input would be at the top of the list of key game design elements. However, that isn't always the case. With all the hype these days surrounding real-time, lifelike 3D graphics engines and positional 3D audio in games, effective user input support is often overlooked. In fact, user input is perhaps the most overlooked aspect of modern game design, which is truly a tragedy. It's a tragedy because user input support in a game directly impacts the playability of the game, and when the user input isn't effective, the play suffers.

    You see, I'm from the old school of game players, and I still remember paying homage to the gods of gaming with my hard-earned allowance in arcades well before there was an option of playing anything other than Pong at home. (See the opener for Chapter 1, "Learning the Basics of Game Creation.") In return for my quarter offerings, the game gods usually provided me with incredibly fun games that usually had to survive on their playability alone. Because the hardware at that time simply couldn't provide a very high level of graphic and sound intensity, game developers were forced to make up for it with game play. Of course, they didn't consider their focus on playability as making up for anything; with the limited graphics and sound capabilities at the time, they didn't have an option.

    Let me give you a quick example of what I'm talking about with regard to playability and user input. One of my all-time favorite games is Ring King, which is a boxing game for the original Nintendo Entertainment System (NES). Ring King is definitely considered "old" by current gaming standards—possibly even ancient. Compared to current games, it has weak graphics, animation, and sound. However, I still play the game simply because it plays so well. That playability is largely based on how the game handles user input; it allows for very subtle timing when you punch and dodge, which goes a long way in a boxing game! Ring King certainly has its limitations, but its designers got it right when they came up with the punch-dodge timing—try to throw a straight lunge punch, and you'll see what I mean. Since then, I've tried to find a modern replacement for Ring King, but with no luck. Although plenty of modern games contain fancy graphics and sound, anything comparable to the responsiveness of the controls in my old favorite is tough to find. I'm still looking, though.

    Lest you think I'm being overly critical of current games, plenty of recent games have incredible user input support, along with awesome graphics and sound. However, an equal number of recent games have killer graphics and sound, but little substance when it comes to playability and user input. These types of games might be visually stunning and fun to listen to, but they rarely have any lasting appeal beyond the initial "Wow!"


    Note - Since I'm playing the role of critic for a moment, I'd like to point out a trend in movies that has paralleled video games in many ways: replacing substance with eye candy. Using science fiction and horror movies as a couple of example genres, compare some of the great movies from 20 years ago with some of the popular, recent movies. By and large, you see better storytelling and a more innovative use of special effects in the older movies; their creators didn't have a choice. Since the maturation of computer-generated effects, too many filmmakers rely on wowing us with over-the-top effects when they're not always necessary. I love special effects as much as anyone else, but the "less is more" adage often holds true. The same rule applies to video games.


    Now, let me step down from the soapbox and get to the real point, which is that you should carefully plan the user input for your games just as you carefully plan the graphics, sound, and game logic. This doesn't mean only deciding between supporting a keyboard or a mouse for the user interface. It means putting some real thought into making the user interface as intuitive as possible. You want the controls for the game to feel as natural as possible to the player. If you really want to see how well your user interface works, create an alternate set of really awful graphics with little or no sound and see if your game is still fun to play.

    SamsThis chapter is from Beginning Game Programming, by Michael Morrison (Sams, ISBN: 0672326590). Check it out at your favorite bookstore today.

    Buy this book now.

    More Gaming Articles
    More By Sams Publishing

    blog comments powered by Disqus

    GAMING ARTICLES

    - An Ugly Side to Gaming`s Boy`s Club
    - Wii U Offers Secretly Cool Features
    - OUYA Raises Millions for Open Console Game P...
    - OUYA Kickstarter Project: Bring Back Great G...
    - WWE 13 Video Game: First Look
    - Game Review: Max Payne 3
    - The Top MUD Games
    - Game Review: Tiger Woods PGA Tour 13
    - Game Review:MLB 12 The Show
    - Game Review: Twisted Metal
    - The Top PS Vita Games
    - PlayStation Vita Review
    - Game Review: Star Wars The Old Republic
    - Game Review: WWE 12
    - Video Game Review: X-Men Destiny

    Developer Shed Affiliates

     




    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
    KEITHLEE2zdeconfigurator/configs/INFUSIONSOFT_OVERLAY.phpzdeconfigurator/configs/ OFFLOADING INFUSIONSOFTLOADING INFUSIONSOFT 1debug:overlay status: OFF
    overlay not displayed overlay cookie defined: TI_CAMPAIGN_1012_D OVERLAY COOKIE set:
    status off