Snappy Analog Controls

When you create a game one of the most important things to get right from the start are the controls. If your controls are nice and solid then it’s a lot easier to create layers of gameplay on top of that. If your controls are weird and twitchy then you’ll find yourself tweaking a lot of gameplay simply because everything feels off and the way your game plays is just not what you expect. This is exactly the same for Tricky Towers. Because our game relies heavily on smart thinking and precise stacking of bricks the controls should be really solid. You don’t want to slam your brick down while you were just trying to move it slightly to the left.

When we started implementing the controller support for Tricky Towers we found that most of the development team preferred to use the D-Pad to move their bricks around. It’s fast, precise and chances of making an error by using the wrong button are very slim. But after testing we found that quite a lot of people still pick the analog stick to control the game. It was pretty obvious that we didn’t have a choice: analog controls had to work, because people expect them to.

To achieve the optimal way of handling input we came up with the system of ‘filters’. On top of the raw input that we get from the controllers we apply filters that handle the way we want to interpret these values. This can range from simply making analog input digital, to more complicated methods to see what the player is doing. In case of the left analog stick we started out by simply dividing the analog stick into 4 regions.
analogQuadrants

The tiny red circle in the center of this image represents the current direction of the analog stick. When you press the stick upwards it counts as pressing up on the D-Pad. Press it left, it’s just like a left button press. Sounds simple enough to work right? Unfortunately, it’s not. The controls felt twitchy and even though as a player you might think you have a solid reference as to what direction your thumb is pushing the analog stick into, most of the times it’s not as precise as you’d hope. We’ve seen many cases where players would rotate or slam a brick down on their tower even though they just wanted to give it a little nudge. Especially on the edges of the quadrants (the white lines) the input would get jittery because of slight imprecision of the input values.

The solution we found is quite simple but very effective. Every time you move the analog stick into a certain direction we enlarge the quadrant you’re in. In this example we push the stick to the left. We register this input and therefore enlarge the left quadrant. Now there’s a lot more room for you to move the stick around without accidentally hitting up or down. Once you actually do cross the edge of the left quadrant to for example the upper one, we do exactly the same thing but for the other quadrant.
analogLeftanalogUp

Since the scaling of these areas is done instantly there’s a lot less jittery input between the different directions. Every time you cross the borders between two areas we move the border, so there’s no way you can go back and forth by accident.

There was still some weird behavior when the stick was around the center position because the margins of the areas would become very small. With the slightest movement you would give random input because you actually were switching quadrants by just the slightest movement of your thumb. To fix this problem we simply added a ‘deadzone’ to the center of the analog stick. As long as you stay in this area there won’t be any input registered at all.

analogDeadzoneanalogDeadzoneUp

And that’s it! Now we have nice, solid controls for the analog stick and it’s a matter of preference whether you want to use the D-pad or not!

Comments are closed.