Page 1 of 1

new developer question (kart speed/joystick/general setup

PostPosted: 01 Jun 2015, 02:27
by terrysmith2000
I am still finding my feet here. Patience appreciated.

I am able to build STK (windows 8/strong machine). I have a USB joystick and I am trying to get speeds between stopped and full throttle.

When I press the up arrow and drive with the left/right arrows on the keyboard, I see changes in speed as we hit hills and go into turns. So I can see variable speed.

But when I use a controller, I basically only create those states: key pressed & key not pressed. I've checked with windows control panel. My controller is acting right. I can see behavior from -1 (back) to zero to +1 (full forward) and many steps in between.

I am trying similar stuff described here: viewtopic.php?f=17&t=2806

I also tried supertuxkart.exe --console --log=0 which did not have much effect. I was trying to see my speed as an integer and find out what other debug info developers liked would be shown.

I want to achieve "medium speeds" with my controller.

Bonus points: any tutorial/explanation of how to see internal state is appreciate. In the link I give Auria offers help with where to put debug statements. That is the kind of stuff I am looking for.

thanks

Re: new developer question (kart speed/joystick/general setu

PostPosted: 02 Jun 2015, 01:20
by Auria
Hi,

this is pretty weird, but we've seen so many weird controller behaviors by now that little surprises me anymore (seems like no 2 devices and 2 drivers behave the same way)

A good place to look would be in input/input_manager.cpp, in method InputManager::dispatchInput
You could log parameters "axisDirection" and "value". in something like
{l Code}: {l Select All Code}
if (type == Input::IT_STICKMOTION)
    Log::info("InputDebug", "axisDirection : %i, value: %i", (int)axisDirection, (int)value);


Checking if those values are correct would be the right first step

Re: new developer question (kart speed/joystick/general setu

PostPosted: 02 Jun 2015, 02:08
by terrysmith2000
Thanks, I found that code tonight and it is heartening to see that I am in the right place. I'm using warn because it was faster than figuring out where the log level is set <wince>.

Now with the same controller, I am able to get intermediate speeds. It may be that seeing a digital readout of stick value is helping me use the controller. Or it could be this very inexpensive controller does not work the same way all the time. That said, I am empowered to figure it out. Thanks!

If anyone finds this in the future, consider wrapping the debug statement in an if statement like below. Then a neutral stick will not print info.
if (abs(*value) > 500) { }

Re: new developer question (kart speed/joystick/general setu

PostPosted: 02 Jun 2015, 03:19
by hiker
terrysmith2000 {l Wrote}:Now with the same controller, I am able to get intermediate speeds. It may be that seeing a digital readout of stick value is helping me use the controller. Or it could be this very inexpensive controller does not work the same way all the time. That said, I am empowered to figure it out. Thanks!

I have used a cheap controller in the past, and it actually had two different modes (selected by pressing a certain button on the controller): one analog mode, and one digital. Perhaps your controller does the same and you had it in the wrong mode?

Cheers,
Joerg