Tuesday, August 26, 2008

Change Impact

People might wonder why it takes so long to add "Drum-support" to GZ. After all, it's just another type of controller and a bit of change to how frets are handled, right?

Not quite. I'll give you a small example of why this seemingly easy task has quite an impact on how GZ works "under the hood". Topic: input handling.

GZ used to have two players and each of them has an active Guitar controller. The guitar controller is either a keyboard, joystick or xbox 360 device. Its keys can be configured using the input configuration dialog.

For drum support, you might think it's ok to just keep that scheme and display a dialog upon entering the setlist that asks, which kind of instrument the user wants to play. But stop: Does it really make sense to allow the player to play a drum line with the Guitar?

Nope... so then you think "ok, so we look at the configured controller and that determines, which instrument he wants to play". Sounds good at first. However, I probably want to have all my instruments connected at the same time - so having only one active instrument (as previously) doesn't cut it.

Well, then you think: "The controller that the player used to open the setlist" will determine which instrument he plays. Right....but what about the keyboard? Is that a guitar or drums? Especially with software like "joy2key", the keyboard should be allowed to represent both controllers.

Ok, so now all instruments are connected at the same time and your controller determines what instrument you're playing. But previously, each player used to pre-configure HIS instrument. So how do we now distinguish the two players. Mmmh.... turns out that the whole concept of having "two players" is broken. I mean, picture yourself playing multiplayer and one of you plays drums, the other one guitar - what does it matter, whether you're "player 1" or "player 2"?

So that's how a seemingly small change ripped apart the whole previous input concept.

Task for you: Consider the implications of adding a Mic to the input system, which doesn't even have buttons on its own.

2 comments:

stran said...

maybe you can add a new option in the input setup menu (for each player) like this:
Instrument: (Guitar or Drums) and that selection will determine the available songs in the setlist and the available keys to map (will not have "Whammy, Starpower, Upstrum, DownStrum")(songs that haves drums and/or guitar will show only "Drums" intead of "Guitar, Bass/Rythm, Drums")
hope it helps...

Matt said...

Are you sure you'll be able to get away with asking the controller what it is? There are a LOT of different ways to use a controller for GZ2:

PS2-USB adapter (What I use)
360 controllers
PS3 controllers
Wii Guitar running through GlovePie
PC GH3 controller

The drivers for these will still have those buttons available for assignment. In my case, I have an EMS2USB adapter for PS2 controllers. The device is recognized as two 4-axis 16 button joypads (you can use 2 controllers with it), despite that the guitar only has 10 inputs.

Granted, I don't know any XNA so there may be something in there to poll the controller and get some kind of identification data. If that were possible, you could store the ID in an .ini and do a one-time controller configuration when an unrecognized controller is inserted.

For microphones, first of all, I'd say you should just require USB mics - even without buttons you should still be able to recognize it in code.

For the keyboard: it should just be for menu navigation unless it's used to select a song - in that case, have it look for the mic, guitar, and drums (in that order).

You may have to resign yourself to forcing people to RTFM on a few things - since there are so many devices to consider it won't be as neat or clean-cut as a console.

Keep up the great work!