The thought came to me when I was playing the excellent Little Gamers: Teh Game with my son on community games. We spent a minute or so trying to figure out why the controller wasn't working. Even going as far as to restart the xbox to make sure that the controller was still providing input to the console.
After realizing what was going on, it was obvious that the code probably looked something like this:
GamePadState padState = GamePad.GetState(PlayerIndex.One);Now, this is by no means a critique of the game ... because the game really has a lot of polish (aside from perhaps this one tiny thing). But the code assumed that the player would always be using the controller designated as "player one". When, in reality, I always just pick up whatever controller I see first, regardless of whether it held the player one slot. The code above could be modified for a single player game as below to determine the controller that the player is using:
if (padState.IsButtonDown(Buttons.Start)) { this.StartGame(); }
for (int i = 0; i < 4; i++) { PlayerIndex currentPlayerIndex = (PlayerIndex)i; GamePadState padState = GamePad.GetState(currentPlayerIndex);From that point on, you can use this.CurrentPlayer when querying for input.
if (padState.IsButtonDown(Buttons.Start)) { this.CurrentPlayer = currentPlayerIndex; this.StartGame(); } }
I think that this is actually a symptom of a slightly larger problem. The problem is that there are no standards for XNA games right now. Microsoft has actually made a conscious decision to avoid publishing standards for XNA games because, unlike the strict TCR (Technical Certification Requirement) that fully licensed commercial games must pass, they wanted to lower the barrier to entry for game development.
This is of course a good thing ... however, one of the things that I've been wanting for a long time are guidelines for XNA games. They would offer things that could help a would-be developer add that final polish, that je ne sais quoi. These guidelines could be provided by Microsoft, but I think it would be equally useful to see them community driven using something like XNAWiki.com.
While I'm on the topic of input ... Paul Varcholik has been experimenting with some very interesting technologies such as training input gestures for the wiimote. It would be cool to see this extrapolated to a more general application. This could be used to train combo moves in a fighting game ... or perhaps an RPG where spells must be gestured.
Kinda' like EA Skate :-D