SlideShare a Scribd company logo
1 of 20
Download to read offline
Video Game Development: User InputA. Babadi 1 of 20
In The Name Of God
Video Game Development
Amin Babadi
Department of Electrical and Computer Engineering
Isfahan University of Technology
Spring 2015
User Input
Video Game Development: User InputA. Babadi 2 of 20
Outline
 The keyboard
 Mouse
 Joysticks
 Hardware abstraction
 Force feedback
Video Game Development: User InputA. Babadi 3 of 20
User Input
 A smooth user interaction model is key to any good game.
 Sadly, there will be few general rules.
 User interaction takes place at a relatively low abstraction
level, and implementations tend to be quite hardware
dependent.
Video Game Development: User InputA. Babadi 4 of 20
The Keyboard
 Keyboards are the main input device for PC-based games, but
are also available for mobile phones, some consoles, and palm
devices.
 The most widely available input device!
 Unfortunately, such a popular input device is not very well
suited for games.
Video Game Development: User InputA. Babadi 5 of 20
The Keyboard
 For gaming purposes, two types of routines for reading
keyboards are relevant.
1. Synchronous routines
2. Asynchronous routines
Video Game Development: User InputA. Babadi 6 of 20
1. Synchronous Routines
 Synchronous routines wait until a key is pressed and then
report it to the application.
 Synchronous read modes are used to type information, such
as the character name.
 But they are not very well suited for real gameplay (why?).
Video Game Development: User InputA. Babadi 7 of 20
2. Asynchronous Routines
 Asynchronous routines return immediately after being called,
and give the application information about which keys were
pressed, if any.
 Asynchronous controllers are the way to go!
 They provide fast tests to check the keyboard state efficiently.
Video Game Development: User InputA. Babadi 8 of 20
2. Asynchronous Routines
 Asynchronous routines can also belong to two different
families.
o Some of them are designed to test the state of individual keys (how?).
o Others retrieve the whole keyboard state in a single call.
 What are pros/cons of these 2 sub-types?
 Which sub-type is generally more efficient? Why?
Video Game Development: User InputA. Babadi 9 of 20
Mouse
 Mice are especially popular in PC games, but game consoles
do not usually support them.
 Unlike a keyboard or joystick, a mouse not only generates
button or key presses, but 2D positions as well.
 The operation of the mouse can be divided into transmitting
positional information and sending button press and release
messages.
Video Game Development: User InputA. Babadi 10 of 20
Mouselook
 A popular use of the mouse is to implement the classic
mouselook used in many first-person shooters.
 All we have to do is use the keys to change our position, and
use the mouse to reorient our viewpoint.
Killzone 3
Video Game Development: User InputA. Babadi 11 of 20
Joysticks
 The joystick was introduced in the 1970s as a way to
represent positional data easily.
 The first models were restricted to binary tests.
 Today, all joysticks map the sticks' inclination to a continuous
range of values, so we can control our characters precisely.
 Controlling a joystick is slightly more complex than working
with a keyboard or a mouse (why?).
Video Game Development: User InputA. Babadi 12 of 20
Response Curves
 For example, imagine a game like Mario, where there is no
speed control: Mario is simply running left, running right, or
standing still.
 Assume that the analog output is in the range −100,100 .
 So how do we implement that using an analog controller?
 We need to define a transfer function.
Video Game Development: User InputA. Babadi 13 of 20
Response Curves
Response curve without (left) and with (right) a dead zone.
Video Game Development: User InputA. Babadi 14 of 20
Response Curves
Types of response curves.
Video Game Development: User InputA. Babadi 15 of 20
Hardware Abstraction
 Games that run on platforms that support a variety of input
controllers offer the richest gaming experience.
Video Game Development: User InputA. Babadi 16 of 20
Hardware Abstraction
 There are two paths a developer might follow when coding for
such a platform:
o Some games will choose to use one (and only one) of the existing
controllers.
o Some other games will let the user choose the input method he or
she wants to employ.
 Hardware abstraction means coding your game with a
"virtual" controller in mind, so any controller that conforms to
that abstract profile can be fitted into the code with zero
impact on the game engine.
Video Game Development: User InputA. Babadi 17 of 20
Hardware Abstraction
A possible class structure to implement device abstraction.
Video Game Development: User InputA. Babadi 18 of 20
Force Feedback
 Many input controllers come with some sort of force feedback
these days.
 Force feedback hardware simulates vibration and other force-
based effects by incorporating one or more motors that can
be configured via programming.
 Sadly, these techniques are largely platform dependent.
Video Game Development: User InputA. Babadi 19 of 20
Force Feedback
Microsoft's Force Editor, built into the DirectX SDK.
Video Game Development: User InputA. Babadi 20 of 20
References
 Sanchez-Crespo’s textbook,
 Wikipedia, and
 Some other sources on the Internet.

More Related Content

What's hot

Game Architecture and Programming
Game Architecture and ProgrammingGame Architecture and Programming
Game Architecture and Programming
Sumit Jain
 
Game Memory Optimisation
Game Memory OptimisationGame Memory Optimisation
Game Memory Optimisation
Sumit Jain
 
iOS Game Development: When Cocoa Met Cocos...
iOS Game Development: When Cocoa Met Cocos...iOS Game Development: When Cocoa Met Cocos...
iOS Game Development: When Cocoa Met Cocos...
Joseph Ku
 
Video Game Console
Video Game ConsoleVideo Game Console
Video Game Console
judah43
 

What's hot (20)

Introduction to android (and mobile) game development
Introduction to android (and mobile) game developmentIntroduction to android (and mobile) game development
Introduction to android (and mobile) game development
 
Game Architecture and Programming
Game Architecture and ProgrammingGame Architecture and Programming
Game Architecture and Programming
 
Before starting android game development
Before starting android game developmentBefore starting android game development
Before starting android game development
 
Advanced controlls for android games
Advanced controlls for android gamesAdvanced controlls for android games
Advanced controlls for android games
 
Game Memory Optimisation
Game Memory OptimisationGame Memory Optimisation
Game Memory Optimisation
 
Burgeon Games_Controller_Portfolio
Burgeon Games_Controller_PortfolioBurgeon Games_Controller_Portfolio
Burgeon Games_Controller_Portfolio
 
iOS Game Development: When Cocoa Met Cocos...
iOS Game Development: When Cocoa Met Cocos...iOS Game Development: When Cocoa Met Cocos...
iOS Game Development: When Cocoa Met Cocos...
 
Mobile Game Development in Unity
Mobile Game Development in UnityMobile Game Development in Unity
Mobile Game Development in Unity
 
Car racing game for android
Car racing game for androidCar racing game for android
Car racing game for android
 
Project presentation FPS
Project presentation FPSProject presentation FPS
Project presentation FPS
 
Video game design
Video game designVideo game design
Video game design
 
Final year project presentation
Final year project presentationFinal year project presentation
Final year project presentation
 
Video Game Console
Video Game ConsoleVideo Game Console
Video Game Console
 
VR digest. June 2018
VR digest. June 2018VR digest. June 2018
VR digest. June 2018
 
Android Mp3 Player
Android Mp3 PlayerAndroid Mp3 Player
Android Mp3 Player
 
TheTorus_BurgeonGames
TheTorus_BurgeonGamesTheTorus_BurgeonGames
TheTorus_BurgeonGames
 
JAVA Media Player
JAVA Media PlayerJAVA Media Player
JAVA Media Player
 
One Handed Controller
One Handed ControllerOne Handed Controller
One Handed Controller
 
Playstation 4
Playstation 4Playstation 4
Playstation 4
 
Game software development trends presentation
Game software development trends   presentationGame software development trends   presentation
Game software development trends presentation
 

Viewers also liked

IntroduccióN Al Xna Framework
IntroduccióN Al Xna FrameworkIntroduccióN Al Xna Framework
IntroduccióN Al Xna Framework
guestc5bd81f
 
Teoría xna
Teoría xnaTeoría xna
Teoría xna
Dada3311
 
Devspace12 "¿Y tú qué usas?"
Devspace12 "¿Y tú qué usas?"Devspace12 "¿Y tú qué usas?"
Devspace12 "¿Y tú qué usas?"
DeSEA
 
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
Juan Manuel
 
Introduccion A Xna By Lasa
Introduccion A Xna By LasaIntroduccion A Xna By Lasa
Introduccion A Xna By Lasa
Luis A. Sanchez
 

Viewers also liked (20)

[Code Camp 2009] Desarrollo de videojuegos multiplataforma en la nueva genera...
[Code Camp 2009] Desarrollo de videojuegos multiplataforma en la nueva genera...[Code Camp 2009] Desarrollo de videojuegos multiplataforma en la nueva genera...
[Code Camp 2009] Desarrollo de videojuegos multiplataforma en la nueva genera...
 
Xna game studio presentación 03
Xna game studio   presentación 03Xna game studio   presentación 03
Xna game studio presentación 03
 
02. Platforms and Modes
02. Platforms and Modes02. Platforms and Modes
02. Platforms and Modes
 
IntroduccióN Al Xna Framework
IntroduccióN Al Xna FrameworkIntroduccióN Al Xna Framework
IntroduccióN Al Xna Framework
 
Desarrollo De Videojuegos Con Xna
Desarrollo De Videojuegos Con XnaDesarrollo De Videojuegos Con Xna
Desarrollo De Videojuegos Con Xna
 
Teoría xna
Teoría xnaTeoría xna
Teoría xna
 
Devspace12 "¿Y tú qué usas?"
Devspace12 "¿Y tú qué usas?"Devspace12 "¿Y tú qué usas?"
Devspace12 "¿Y tú qué usas?"
 
07. Data Structures
07. Data Structures07. Data Structures
07. Data Structures
 
Presentacion01
Presentacion01Presentacion01
Presentacion01
 
Herramientas para el Desarrollo de Videojuegos
Herramientas para el Desarrollo de VideojuegosHerramientas para el Desarrollo de Videojuegos
Herramientas para el Desarrollo de Videojuegos
 
Semilerovideojuegos xna
Semilerovideojuegos xnaSemilerovideojuegos xna
Semilerovideojuegos xna
 
[Code Camp 2009] Desarrollo de juegos con XNA (Ángel Arcoraci)
[Code Camp 2009] Desarrollo de juegos con XNA (Ángel Arcoraci)[Code Camp 2009] Desarrollo de juegos con XNA (Ángel Arcoraci)
[Code Camp 2009] Desarrollo de juegos con XNA (Ángel Arcoraci)
 
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
Una breve resParte I. Desarrollo de VideoJuego: MonoGame en Windows 8.
 
08. Design Patterns
08. Design Patterns08. Design Patterns
08. Design Patterns
 
Xna game studio presentación 01
Xna game studio   presentación 01Xna game studio   presentación 01
Xna game studio presentación 01
 
Perspectiva por Enrique Fuentes
Perspectiva por Enrique FuentesPerspectiva por Enrique Fuentes
Perspectiva por Enrique Fuentes
 
Xna game studio presentación 04
Xna game studio   presentación 04Xna game studio   presentación 04
Xna game studio presentación 04
 
Introduccion A Xna By Lasa
Introduccion A Xna By LasaIntroduccion A Xna By Lasa
Introduccion A Xna By Lasa
 
Xna game studio presentación 02
Xna game studio   presentación 02Xna game studio   presentación 02
Xna game studio presentación 02
 
Presentacion04
Presentacion04Presentacion04
Presentacion04
 

Similar to 09. User Input

Funky game engines
Funky game enginesFunky game engines
Funky game engines
eduriez
 
Michael Hughes - Y1 GD ngine_terminology
Michael Hughes - Y1 GD ngine_terminologyMichael Hughes - Y1 GD ngine_terminology
Michael Hughes - Y1 GD ngine_terminology
Mike Hughes
 
Y1 gd engine_terminology -MPH (Michael P. Hughes)
Y1 gd engine_terminology -MPH (Michael P. Hughes)Y1 gd engine_terminology -MPH (Michael P. Hughes)
Y1 gd engine_terminology -MPH (Michael P. Hughes)
Mike Hughes
 
Video Game Making and Mind Reading Game Console
Video Game Making and Mind Reading Game ConsoleVideo Game Making and Mind Reading Game Console
Video Game Making and Mind Reading Game Console
Anup Yadav
 
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
kalelboss
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminology
JoshCollege
 

Similar to 09. User Input (20)

06. Game Architecture
06. Game Architecture06. Game Architecture
06. Game Architecture
 
Funky game engines
Funky game enginesFunky game engines
Funky game engines
 
android mario project
android mario projectandroid mario project
android mario project
 
An Introduction To Game development
An Introduction To Game developmentAn Introduction To Game development
An Introduction To Game development
 
Michael Hughes - Y1 GD ngine_terminology
Michael Hughes - Y1 GD ngine_terminologyMichael Hughes - Y1 GD ngine_terminology
Michael Hughes - Y1 GD ngine_terminology
 
Gaming technology
Gaming technologyGaming technology
Gaming technology
 
Gaming technology
Gaming technologyGaming technology
Gaming technology
 
Y1 gd engine_terminology -MPH (Michael P. Hughes)
Y1 gd engine_terminology -MPH (Michael P. Hughes)Y1 gd engine_terminology -MPH (Michael P. Hughes)
Y1 gd engine_terminology -MPH (Michael P. Hughes)
 
Gaming
GamingGaming
Gaming
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
IRJET- SteganoPIN:Two Faced Human-Machine Interface for Practical Enforcement...
IRJET- SteganoPIN:Two Faced Human-Machine Interface for Practical Enforcement...IRJET- SteganoPIN:Two Faced Human-Machine Interface for Practical Enforcement...
IRJET- SteganoPIN:Two Faced Human-Machine Interface for Practical Enforcement...
 
Zombi - Shoot for Survive
Zombi - Shoot for SurviveZombi - Shoot for Survive
Zombi - Shoot for Survive
 
Video Game Making and Mind Reading Game Console
Video Game Making and Mind Reading Game ConsoleVideo Game Making and Mind Reading Game Console
Video Game Making and Mind Reading Game Console
 
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
351111888-Commodore-64-Assembly-Language-Arcade-Programming-pdf.pdf
 
01. A Brief Overview
01. A Brief Overview01. A Brief Overview
01. A Brief Overview
 
User Experience 4: Usable User Interface
User Experience 4: Usable User InterfaceUser Experience 4: Usable User Interface
User Experience 4: Usable User Interface
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
 
Introduction to game development
Introduction to game developmentIntroduction to game development
Introduction to game development
 
Retrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESRetrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NES
 
Joshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminologyJoshua meyer y1 gd engine_terminology
Joshua meyer y1 gd engine_terminology
 

More from Amin Babadi

More from Amin Babadi (6)

General Game Playing: Challenges and Opportunities
General Game Playing: Challenges and OpportunitiesGeneral Game Playing: Challenges and Opportunities
General Game Playing: Challenges and Opportunities
 
EnHiC: An Enforced Hill Climbing Based System for General Game Playing
EnHiC: An Enforced Hill Climbing Based System for General Game PlayingEnHiC: An Enforced Hill Climbing Based System for General Game Playing
EnHiC: An Enforced Hill Climbing Based System for General Game Playing
 
10. Fundamental AI Technologies
10. Fundamental AI Technologies10. Fundamental AI Technologies
10. Fundamental AI Technologies
 
05. Vectors
05. Vectors05. Vectors
05. Vectors
 
04. The Rendering Pipeline
04. The Rendering Pipeline04. The Rendering Pipeline
04. The Rendering Pipeline
 
03. Goals and Genres
03. Goals and Genres03. Goals and Genres
03. Goals and Genres
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 

09. User Input

  • 1. Video Game Development: User InputA. Babadi 1 of 20 In The Name Of God Video Game Development Amin Babadi Department of Electrical and Computer Engineering Isfahan University of Technology Spring 2015 User Input
  • 2. Video Game Development: User InputA. Babadi 2 of 20 Outline  The keyboard  Mouse  Joysticks  Hardware abstraction  Force feedback
  • 3. Video Game Development: User InputA. Babadi 3 of 20 User Input  A smooth user interaction model is key to any good game.  Sadly, there will be few general rules.  User interaction takes place at a relatively low abstraction level, and implementations tend to be quite hardware dependent.
  • 4. Video Game Development: User InputA. Babadi 4 of 20 The Keyboard  Keyboards are the main input device for PC-based games, but are also available for mobile phones, some consoles, and palm devices.  The most widely available input device!  Unfortunately, such a popular input device is not very well suited for games.
  • 5. Video Game Development: User InputA. Babadi 5 of 20 The Keyboard  For gaming purposes, two types of routines for reading keyboards are relevant. 1. Synchronous routines 2. Asynchronous routines
  • 6. Video Game Development: User InputA. Babadi 6 of 20 1. Synchronous Routines  Synchronous routines wait until a key is pressed and then report it to the application.  Synchronous read modes are used to type information, such as the character name.  But they are not very well suited for real gameplay (why?).
  • 7. Video Game Development: User InputA. Babadi 7 of 20 2. Asynchronous Routines  Asynchronous routines return immediately after being called, and give the application information about which keys were pressed, if any.  Asynchronous controllers are the way to go!  They provide fast tests to check the keyboard state efficiently.
  • 8. Video Game Development: User InputA. Babadi 8 of 20 2. Asynchronous Routines  Asynchronous routines can also belong to two different families. o Some of them are designed to test the state of individual keys (how?). o Others retrieve the whole keyboard state in a single call.  What are pros/cons of these 2 sub-types?  Which sub-type is generally more efficient? Why?
  • 9. Video Game Development: User InputA. Babadi 9 of 20 Mouse  Mice are especially popular in PC games, but game consoles do not usually support them.  Unlike a keyboard or joystick, a mouse not only generates button or key presses, but 2D positions as well.  The operation of the mouse can be divided into transmitting positional information and sending button press and release messages.
  • 10. Video Game Development: User InputA. Babadi 10 of 20 Mouselook  A popular use of the mouse is to implement the classic mouselook used in many first-person shooters.  All we have to do is use the keys to change our position, and use the mouse to reorient our viewpoint. Killzone 3
  • 11. Video Game Development: User InputA. Babadi 11 of 20 Joysticks  The joystick was introduced in the 1970s as a way to represent positional data easily.  The first models were restricted to binary tests.  Today, all joysticks map the sticks' inclination to a continuous range of values, so we can control our characters precisely.  Controlling a joystick is slightly more complex than working with a keyboard or a mouse (why?).
  • 12. Video Game Development: User InputA. Babadi 12 of 20 Response Curves  For example, imagine a game like Mario, where there is no speed control: Mario is simply running left, running right, or standing still.  Assume that the analog output is in the range −100,100 .  So how do we implement that using an analog controller?  We need to define a transfer function.
  • 13. Video Game Development: User InputA. Babadi 13 of 20 Response Curves Response curve without (left) and with (right) a dead zone.
  • 14. Video Game Development: User InputA. Babadi 14 of 20 Response Curves Types of response curves.
  • 15. Video Game Development: User InputA. Babadi 15 of 20 Hardware Abstraction  Games that run on platforms that support a variety of input controllers offer the richest gaming experience.
  • 16. Video Game Development: User InputA. Babadi 16 of 20 Hardware Abstraction  There are two paths a developer might follow when coding for such a platform: o Some games will choose to use one (and only one) of the existing controllers. o Some other games will let the user choose the input method he or she wants to employ.  Hardware abstraction means coding your game with a "virtual" controller in mind, so any controller that conforms to that abstract profile can be fitted into the code with zero impact on the game engine.
  • 17. Video Game Development: User InputA. Babadi 17 of 20 Hardware Abstraction A possible class structure to implement device abstraction.
  • 18. Video Game Development: User InputA. Babadi 18 of 20 Force Feedback  Many input controllers come with some sort of force feedback these days.  Force feedback hardware simulates vibration and other force- based effects by incorporating one or more motors that can be configured via programming.  Sadly, these techniques are largely platform dependent.
  • 19. Video Game Development: User InputA. Babadi 19 of 20 Force Feedback Microsoft's Force Editor, built into the DirectX SDK.
  • 20. Video Game Development: User InputA. Babadi 20 of 20 References  Sanchez-Crespo’s textbook,  Wikipedia, and  Some other sources on the Internet.