[gameprogrammer] Customizable Input

I've been toying with the idea of trying to get customizable key inputs for a game I'm working on, and was just interested in getting some ideas from you guys & gals (if there are any here) that have already attempted this sort of thing.

What I've been contemplating was to have an enumeration of actions that would be available to the user, like so:

enum Actions { ACTION_ACCELERATE, ACTION_BRAKE, ACTION_STEERLEFT, ACTION_STEERRIGHT, ACTION_TURBO, ... };

From that, I had thought of making a map container that would use the actual keycode as the key in the pair, and the action as the value; since, I would like to give players the option of mapping 2 keys (keyboard and gamepad/joystick) to an action. Now, whenever input is received from a device, the InputManager would check to see what was pressed, and would add an action entry into a kind of ActionQueue. The ActionQueue would then cycle through all of the actions it had been given during that frame, and would act accordingly. I thought of doing it this way so that I could use it for an AI controlled player too, and I would just send the id number of the player (whether it's a real person, or AI) and the action that was performed.

Anyone have any thoughts on this? Any advice would be much appreciated.

Kevin




--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: