Monday, May 3, 2010
By: Matthew Doucette
If you are making a multidirectional moving or shooting XNA game, your controls may be broken. This mistake is so common I decided to write an article on it. Read a slightly edited blurb I wrote on the XNA forums:
Slowly rotate your fire or move your character around in a circle and it should not lock to the direct up, down, left, right directions (12, 3, 6, 9 on the clock). Most XNA dual-stick shooters make this mistake. I'm surprised developers miss this control issue in arcade games. Anyone who is a fan of Geometry Wars will feel your controls are bad, perhaps without knowing why. You are stealing away their skill. They'll aim precisely and your game will ignore it. The dead zone, when the game locks the axis to zero, should activate when you are not shooting or not moving, but never lock left and right when you are moving up and down, and vice-versa. The worst thing is, the better the gamer, the more they'll be frustrated by this.
HOPE THIS HELPS!!!
That's the problem, here's the fix (quoted from Jason, our lead programmer):
He's using the default:
"IndependentAxes The X and Y positions of each stick are compared against the dead zone independently. This setting is the default when calling GetState."
He should use:
"Circular The combined X and Y position of each stick is compared against the dead zone. This provides better control than IndependentAxes when the stick is used as a two-dimensional control surface, such as when controlling a character's view in a first-person game."
The default means if X is near 0, it becomes 0, regardless of Y. So anything near up or down becomes up or down. This is good for 4-way motion.
As you can see, XNA defaults to using independent Axes, and most newcomer developers simply don't know enough about XNA and sometimes about gaming to know differently.
That is all.
About the Author: I am Matthew Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $180,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.