Contents
Programming Responsiveness
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Lead World Designer
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
 
Designing Games Is About Matching Personalities [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Programming Responsiveness
by Mick West
15 comments
Share RSS
 
 
July 9, 2008 Article Start Previous Page 3 of 3
 

Other factors can contribute to lag, further compounding the consequences. Movement can be driven by animations, with velocity changes built into specific time points in an animation. For example, if the animator places the jump velocity impulse a fraction of a second into the animation to better match the visuals, it might look better, but it feels bad.

The animator can correct it by making sure the velocity impulse is on the first frame of animation when the player needs that immediate feedback. But then the question is how does triggering an animation translate into actual movement?

It's quite likely that animation updating is handled by the Render() function. Any events triggered by the animation will not be handled until the time around the loop, which adds another frame.

In addition, triggering an animation might not make it advance a frame until the next frame, delaying the event firing for a frame. Our lag could potentially be increased from six to eight frames, which would be quite unplayable, even at 60 frames per second.

That's not the end of it either. There are many other ways in which extra frames of lag sneak their way into a game. You might be pipelining your physics on a separate thread (or a physics processing unit).

What if you're using triple buffering to smooth your frame rate? You could be using abstract events that take a couple of passes through the system to resolve into real events. You might use a scripting language that adds an additional frame in the way it waits for an event.

It's quite possible to make your game logic incredibly flexible by abstracting various concepts of time and events, and yet while doing this, programmers can lose sight of exactly what's going on under the hood, making it far easier for additional frames of delay to creep in.

Responsiveness, Not Reaction Time

One of the great misconceptions regarding responsiveness is that it's somehow connected to human reaction time. Humans cannot physically react to a visual stimulus and then move their fingers in less than one-tenth of a second.

Game players' peak reaction times vary from 0.15 seconds to 0.30 seconds, depending on how "twitchy" they are. Quantifiables such as these are often brought up when discussing game responsiveness, but the connection is specious.

It's not how fast a player reacts to the game; it's how fast the game reacts to the player. The issue is not one of reaction times, but of synchronization.

Take Guitar Hero, for example, a game in which symbols come at you, the player, and you have to hit the correct button at a very precise point in time (when the target object is within a particular region). You are anticipating the future event, and there is no reacting involved at all.

The problems of lack of responsiveness occur when the game does not react fast enough to the player and the target object has moved beyond the target region by the time the event occurs.

If you press the button at the correct time, you do not expect the object to move even a few more pixels before it explodes. But since objects generally move at least a few pixels per frame, having a few frames of lag can permit the object to drift past its target.

Many action games are based around anticipation and button pressing. In a skateboarding game, you want to jump just before you hit the end of a rail. In a first-person shooter, you fire the instant someone moves in front of your gun.

Again, this is not reaction time. You usually have seen the target at least half a second before you shoot it, probably more, and will be either moving the gun, or waiting for the target to move in front of the gun.

Because of the somewhat unintuitive nature of these problems with responsiveness, it is important for programmers to fully understand the issues. The most important thing is to be able to clearly describe the frame-by-frame path through logic and rendering that a button-triggered action takes before it creates visual feedback. Once you have this, you can optimize it as close to the optimal pathway as possible.

[EDITOR'S NOTE: This article, originally published in Game Developer magazine, was independently selected by Gamasutra's editors, since it was deemed of value to the community. Its republishing has been made possible by Intel, as a platform and vendor-agnostic part of Intel's Visual Computing microsite.]

 
Article Start Previous Page 3 of 3
 
Comments

Jeremy Alessi
profile image
Great article!

Aaron Casillas
profile image
nice work! In regards to even triggering, one of the biggest culprits that keeps coming up in the collision system which handles volume triggers.

Say you want to fire an event upon the player touching the volume of a trigger, if the updates are too slow, the player will be well within the even trigger before its fired. This could lead to level designers feeling that there is something "untimed" about their design.

Now on the flip side, if this issue is not fixed early on in the production, then it will mean that the events in the levels, especially for a highly scripted game would have most likely been tuned with this bug; SO changing it or fixing it would break the pacing of your levels...

Another time to look for this problem is when engineers are in their "optimization" phase, one of the first things that gets tweaked is the collision system....and in a cube somewhere a level designer is pulling his hair out!

Anonymous
profile image
Good work; opened my eyes to something I've been taking for granted.

Oliver Snyders
profile image
When I started reading this, I was reminded of John Carmack's Quakecon Keynote, where he declared he wanted to find out where all the lag comes from, even if it's a fraction of a second.

Articles like this (and thinking a lot about responsiveness) is, as stated, hugely important - player feedback is one of my hang-ups and can remove all feeling from a game if the delay is significant (a few fractions of a second even).

Thanks.

Tynan Sylvester
profile image
Great article. I never realized how many different ways this can get screwed up. Add in lag from wireless controllers and drivers and I can imagine it would get pretty hellish. It's amazing how much this one subtle thing can affect enjoyment of a game. And sometimes you don't even notice it.

This is one area where old systems have an advantage. I guess the days of 1-frame reaction times, like with the good old NES, are over.

Farbs Farbs
profile image
Great article Mick!

Another place I've found input lag is in the network layer. Where possible you want to simulate player actions on the client, so when you turn left you don't have to wait for your input to travel up to the server, be applied to the game state, travel back to the client, then wait for render. Strangely enough I even found this once in a single player game. Input events were being batched in a network queue, pumped to localhost, received, and then interpreted all on the same machine!

Hélder Gomes Filho
profile image
This article explained to me where my lag came from :P

I done my best to squeeze the maximum performance of my mouse-reading and drawing func, and still it lagged several frames behind, when I turned on triple buffering, the lag was reduced, but if I turned on the system cursor I could still see that lag is still present...

fortunally I gave up :P since my code was already at the state of the mininum lag (ie: the optimum code that he described in the start of the article)

B N
profile image
Hi, I didn't read this yet as I'm just heading out, but it made me immediately think about those third person games where when you move the opposite direction that you're facing the guy circles around then starts heading the direction you want to go. I think GTAIV suffers from this, and it really is annoying to me to experience this unresponsive movement. I think in a third person game the character should immediately start heading the direction that you press by turning themselves 180 degrees if necessary instead of doing a semi circle to turn around.

Maybe you guys don't even know what I am talking about, but hopefully some of you do. I think this is one of the biggest causes for me of that feeling of unresponsiveness.

William Lin
profile image
This article missed an important concept - "present". It's not only how fast computer could react to user input, it's also a problem that CPU is not dealing with "present" time. Game player always thinks what he's seeing is what is happenning at present, he presses a key according to the "present" condition he has seen on the screen, but the CPU gets the input at the time is processing the "future". So CPU must think the input comes from the current frame player is seeing not the frame CPU is processing. This is more important than the CPU reaction time to user input. Use Guitar hero as an example, the problem is not how fast player could see reaction on screen, it's how CPU identifying the correct frame the player pressed the key.

Mick West
profile image
B N, I know exactly what you are talking about, and I wrote an article about it.

http://cowboyprogramming.com/2008/04/23/running-in-circles/

Mick West
profile image
William, I think it's kind of the same issue. If there were zero lag, then all the "present" moments would be at the same time. Increasing the lag increases the time between the "present" moment, and when the computer catches up, and when that moment arrives on screen.

However, having a concept of the "present" is important for handling lag that is unavoidable. In GH (and in most games), the game needs to be aware that the player is not seeing what it thinks what the current state is, but rather is seeing a few frames back. Games should allow the player a degree of slop in their synchronization to account for this. I touched on this in my "Pushing Buttons" article:

http://cowboyprogramming.com/2007/01/02/pushhing-buttons/

Ken Nakai
profile image
The funny thing is, if the lag isn't crazy (i.e. slide show) and the game is compelling enough, gamers will deal with it. I and the gamers I know who play FPSs all deal with each game's characteristics when it comes to accuracy and response time. When the game goes online, you compensate. Obviously, there's a lot of "haxor" and "wtf?" going on because you shoot a shot that looks like it hit on target but because of net and server lag, it ends up being calculated and registered an inch to the left. You could actually control some of this with perception (if someone sees that their ping is crap, they assume that's the issue)...what if ping included the processing time as well?

Gregory Massal
profile image
With so many layers (physics, ai game logic, rendering, buffering etc, each feeding into the next) it's sometimes hard to reduce the lag. But to adopt a PC centric view, usually the hardware cursor is considered to be rather responsive, yet it is usually hard to get the same kind of responsiveness through a rendered cursor.

I've discussed the issue further here :
http://www.codermind.com/answers/How-do-I-reduce-mouse-lag-in-my-3D-application.
html

The irreducible part is : the latency of the mouse driver, the refresh rate (if you had really good control about refresh rate then it's possible to do better but that's usually something from the past like Amiga programming, not PC), and the LCD latency (LCD add latency too. They could add on average a whole frame of delay compared to an equivalent CRT and I'm not talking about remanence : see http://www.behardware.com/articles/632-1/lcds-images-delayed-compared-to-crts-ye
s.html ).

jessica winslet
profile image
“I’m assuming you are not talking about the standard key-repeat rate here…”No, I figured that much out (not on the first try, but the 2nd try.)“For example if you are moving and change direction, then you use a different acceleration than if you are stationary and start moving.”I think I did something along those lines (will have to go back and look and see what I did.)“You’ll also want some hard limits [url=http://www.newslotsgames.net]latest slot machine games[/url] on velocity in addition to friction.”Yeah, got that. Somewhat arbitrarily chosen values, hard to figure, except by trial and error, I guess.My suspicion is that that the keyboard can never be as good as the joystick, simply because it provides less information. What few testers I’ve had have told me I’ve made improvements in the keyboard, but it’s hard to know if you’ve maxed out the “goodness” of the keyboard response.

jessica winslet
profile image
“I’m assuming you are not talking about the standard key-repeat rate here…”No, I figured that much out (not on the first try, but the 2nd try.)“For example if you are moving and change direction, then you use a different acceleration than if you are stationary and start moving.”I think I did something along those lines (will have to go back and look and see what I did.)“You’ll also want some hard limits http://www.newslotsgames.net on velocity in addition to friction.”Yeah, got that. Somewhat arbitrarily chosen values, hard to figure, except by trial and error, I guess.My suspicion is that that the keyboard can never be as good as the joystick, simply because it provides less information. What few testers I’ve had have told me I’ve made improvements in the keyboard, but it’s hard to know if you’ve maxed out the “goodness” of the keyboard response.


none
 
Comment:
 


Submit Comment