Skip to content

WIP: Controller analog movement

This branch is WIP until analog movement is implemented.

The plan is

  • Refactor movement to use two variables instead of 4 (forwardctrl and strafectrl).
  • Allow controls configuration to have separate configurations for gamepad and keyboard
  • Switch forwardctrl and strafectrl to be analog: have different effects when not pressed all the way down.

This last part will be tricky: the game code is very 'four button'-oriented. Ideally, when this branch is finished, the game will behave exactly the same for keyboard users, but gamepad users will be able to fine-tune their angle and (to some degree) their speed. The latter might have some issues, as I'm not planning to add any new animations to the game (though it might be reasonable to re-use the walk animation when you're running at a lower speed).

We'll map the joystick to the following forwardctrl, strafectrl values, which will behave like the following keypresses (note how there is room allocated for the dead-zone of analog controllers):

-2 -1 -.5 0 .5 1 2
WA WA W WD WD
WA WA W WD WD
A A D D
AS AS S SD SD
AS AS S SD SD

Intermediary values (blank in the table above) will allow you to turn turner, walk a direction, run at a more precise angle.

Merge request reports