USB game controller not working correctly.

Started by rogerdg, July 23, 2021, 01:38:31 AM

Previous topic - Next topic
I have a Windows 10 laptop running Solarus Version 1.6.5 that I just downloaded today. I used to play with the program using a keyboard on a Windows 8 machine, but after upgrading, decided to try out my old game controller.

When I run calibration for the controller in Win 10, everything looks OK, but when I start Solarus, the character only goes diagonally up-left or down,right when I press and hold a direction button until it hits a wall, then moves in a single direction until it hits another wall, and stops moving when it hits a corner.

The character stops as expected when the movement button is released, and resumes when the button is pressed again.

Pressing KEY(S) cause the character to go DIRECTION
               Up                                                Nowhere
               Up-Right                                       Down-Right                               
               Right                                             Down-Right
               Down-Right                                  Down-Right
               Down                                            Nowhere
               Down-Left                                    Up-Left
               Left                                              Up-Left
               Up-Left                                         Up-Left

I am not sure where in the code to look for the cause of this issue.  If someone could point me in the right direction, I could try to figure out how to correct the character moves for my gamepad.


Great games require creative programmers...


So you could add code like this somewhere in your game where it will run, like the game manager if you're using one, or something like that

function game:on_joypad_button_pressed(button)
  print("Pressed button:", button)

function game:on_joypad_button_released(button)
  print("Released button:", button)

function game:on_joypad_axis_moved(axis, state)
  print("Axis moved:", axis, state)


See and below events for the details of all joypad inputs.
This will let you see what the engine is seeing- you can compare this to what you're actually pushing, to see if the problem is that the engine is getting the wrong inputs, or if the game is processing them incorrectly.

Also, this is maybe obvious, but your controller could also maybe be broken. You did say it's an old game controller, maybe the most obvious thing is to try a different one and see if the problem is just with the controller.

Also, feel free to post on the Solarus discord, the forums aren't nearly as active : )