Alpha 21: Controller Support


🎮 Controller Support

As everything in game dev, adding controller support took much more effort than I anticipated. While it was easy to add basic controller support thanks to Godot, I had to fine-tune and fix a few things to make it enjoyable.

Also, I only have a Nintendo Switch controller to test input on my MacBook, which doesn’t feel super comfortable. I ordered an Xbox Controller to test with that as well, as it appears to be the most popular with steam gamers.

Aiming With The Controller

To enable controller aiming, a added a new “target” abstraction. When the user plays with keyboard/mouse, the target follows the mouse cursor. For controller input, the right analogue stick determines the position of the target.

For controller input, the target rotates around the player at a fixed distance, based on the direction of the right analogue stick. Aiming this way was very hard. It was so hard that it wasn’t fun. So I added “aim assist”:

Aim Assist

“Aim assist” helps the player by correcting their controller aim towards the nearest target. I implemented it in a “two-tier” fashion, which means that it first checks for targets closer to the player and if there are no close targets, it also checks in a wider area.

The correction works based on the angle between the actual aiming of the player and the enemy. It selects the enemy with the smallest angle to the actual aiming and moves the target to aim directly at the enemy instead.

During play, I found that it felt very natural and made the game much more enjoyable.

Dynamite Free Aim

The “dynamite” ability throws the dynamite at the location of the target. For mouse input, this means you can throw the dynamite anywhere on the screen, wherever the mouse is at the point of triggering the skill.

For controller input, the target now hovers around the player, which means you were only able to throw dynamite directly in front of you. Which, by the way, also hurt yourself.

As a solution, I implemented “free aim” which activates as soon as you hold down the “dynamite” skill button (left trigger or pressing left stick). While free aim is active, you can move the target freely within the current camera view using the right stick. Once you release the button, the dynamite flies to that location and the target is moved back to the player character.

Switching Input Methods

I wanted the player to be able to switch input methods at any time. The game will now recognize a switch immediately when the player uses the keyboard/mouse or controller after using the other.

This means that target movement adapts whenever you pick up the controller or move over to keyboard/mouse input.

The icons of the skills and terminal also switch as soon as you switch the input method.

You can switch between input methods at any time during the game and also back-and-forth.

Camera

When you look into a certain direction with your mouse or controller, the camera shows more of that side of the player character. This makes the game more enjoyable, because you see more of where you’re aiming at.

However, camera movement did not feel good with the controller and made me dizzy. When moving the target quickly in opposite directions with the right stick, the camera would move much too quickly and confuse me.

I slowed the camera down significantly and also reduced the distance that you can move it away from the main character by looking in a direction.

UI

There was an issue when switching from mouse to controller while the mouse hovered over a UI element. I wasn’t able to change focus with the controller’s buttons. As a workaround, I briefly ignore the mouse for the hovered element, which “releases” it and allows the controller to change focus as expected.

Files

echoes-of-imbalance-web.zip Play in browser
Version 0.0.21 10 days ago
echoes-of-imbalance-win.zip 37 MB
Version 0.0.21 10 days ago
echoes-of-imbalance-mac.zip 57 MB
Version 0.0.21 10 days ago
echoes-of-imbalance-linux.zip 31 MB
Version 0.0.21 10 days ago

Get Echoes Of Imbalance

Leave a comment

Log in with itch.io to leave a comment.