Monday, May 7, 2012

Setting up the Gamepad

Setting up the game pad for games like Guild Wars or Tera or even Mass Effect using XPadder was inherently easy, just took some time to make sure I had all the buttons necessary to use all mapped out.  But how does one setup a game pad for a game like Diablo 3 or Torchlight?  There are no mechanics to control your character via the keyboard, these are mouse driven games.

Well, with a little thinking outside the box and some help from some simple AutoIT script programming, I actually got it to work.  I tested this with Torchlight last night and I was able to level a Destroyer to level 10 and even continue leveling my 29 Rogue all with just the game pad, and NO hand cramps!

Here's the gist of the coding behind my AutoIT script:

  1. Place mouse cursor at the center of your character (different from every game, but is offset of Y from the center of your screen, different for each resolution)
    1. I call this the center of gravity, because your cursor always gravitates towards this center and you use the left stick to force the cursor away from the center of gravity.
    2. Force of gravity determines how far away you can move your cursor away from center when the stick is pushed to the edge
    3. Going to try and build some code to detect resolution and the game you are playing to auto-adjust values for the center of gravity.
  2. Detect left stick movement beyond the dead zone, which is defined by raw values of stick movement and center.
    1. Using a series of If/Then statements detect stick's X/Y as +/- from center (65536 / 2)
  3. Define Force to gravity; essentially take the raw data from the stick movement and divide by a certain amount to keep the cursor within 100 points of center.
    1. In order to account for ranged attacks I added a modifier that if SHIFT (button mapped by XPadder) is held down, the range increases (force decreases) to about 500 points from center allowing easier targeting and aiming at a distance.
    2. Using SHIFT also keeps your character still so you automatically try to attack using ranged or use area skills when you press this modifier.
  4. When the stick movement is detected and placed on the screen, the left mouse button is pressed every .2 seconds (done with XPadder)

The only issue I had while playing Torchlight is that I would pick up EVERYTHING that was dropped very easily by just moving around.  But this is an issue with Torchlight, the left mouse button controls movement and ALL interaction.  This is also an issue while in town as I would talk with people constantly, and sometimes would trigger going up a dungeon level just after I went down it because the mouse clicks are so fast.  The range trigger helped with these issues once I implemented it, but I had to remember to use it.

But really, I had such a blast playing Torchlight last night, I honestly feel that this should have been a viable control scheme integrated by the designer.  But even games like Diablo 3 which are cutting edge action RPGs completely ignore game pad integration!  It's mind boggling how well this works and how easily it was implemented (still needs some tweaking though).

Even better, is that Diablo 3 has a dedicated move key.  When pressed it will automatically move you towards your cursor without interacting with anything.  This is awesome because I can modify XPadder to use that key instead of mouse click and all my small issues with Torchlight will disappear!  D3 begs to have official controller support like this!

No comments:

Post a Comment