Good Idea Games‎ > ‎

Implementing Input Dog

posted Dec 5, 2017, 3:22 PM by Good Idea Games   [ updated Dec 5, 2017, 3:23 PM ]
Time Throttle has some major issues with its controller input. Most significantly, the menu can only operated by game pad device ID 0, and apparently if it gets unplugged, Windows reconnects it as Device ID 1. Long story short, if I unplug a gamepad, I have to reboot to play Time Throttle again.

Input Dog is a Game Maker asset that should address this.

To familiarize myself with this asset, I'm going to start by importing it into a blank project, and walk through it's intended functionality in this article.
I am pleased to say that input dog works right on import, though as I type this, the little dogs are moving around and my controller vibrates every time I hit 'm'. Apparently it doesn't care whether the associated application is in an active window or not.





Configuring Input Dog
Input Dog starts by opening the 'rInputManager' room, which creates a unique InputForPlayer object for each player in the game.  This loads a pre-defined configuration for each player, where named game functions are mapped to one or more inputs. 
For example, in the screen shot to the left, you can see that player 1's game function "bark" is mapped to N, or gp_face3.
The actual game effect of "bark" is defined as a part of the Example Dog object.
Input Dog then transitions to 'rExampleRoom' where it loads an Example Dog (player) object for each player, and a mouse-clickable button to transition each player to a special room for configuring their controls.

Off the shelf, these controls are limited to a single keyboard command and a single joystick command. 

Input Dog appears to assign game pads to players on launch, and each player can only accept input from a single game pad (though interestingly, a single game pad can control multiple players). 
Input Dog seamlessly accepts input from both X_INPUT and DIRECT_INPUT devices, which means immediate compatibility with more devices.

This is already structurally similar to Time Throttle, where player craft are immediately playable in the configuration menu.

Like in Time Throttle, player controls are defined as part of the player object itself.

I should be able to replace my current gamepad button checks with inputdog function calls, and even without understanding how inputdog works under the hood, I suspect for most functions this will just work.





To Be Continued...
Comments