News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Controller tests

Started by Duplode, February 17, 2023, 06:33:02 AM

Previous topic - Next topic

Duplode

If you looked at the ZakStunts shoutbox on the ZCT258 deadline day, you may have noticed that @Erik Barros , @Overdrijf and me have been doing a few test with playing Stunts on alternative controllers. I'll open this thread with a report on using a Xbox 360 controller.

Setting it up

First, here is how I (with some help from Erik) have set up the controller on DOSBox. I'm currently using DOSBox Staging 0.80.1 on Linux. The operating system shouldn't matter much; however, DOSBox Staging has improved support for controllers, including the ability to have more than two analog axes recognised as such (see the 0.75.1 release notes).

With the default configuration, DOSBox Staging will map the x and y analog axes (steering and accelerator/brakes) to the left analog stick, and joystick buttons 1 and 2 (shift up and down) to Xbox buttons A and B. While that is reasonably faithful to what you'd get with the kind of joystick originally supported by Stunts, it is also suboptimal in that it is not very comfortable to have steering, accelerator and brakes on a single analog stick, specially given the wealth of options offered by the Xbox controller:



Xbox 360 controller diagram. Source: https://github.com/dosbox-staging/dosbox-staging/wiki/Keymapper

Changes to the controller layout are done through the DOSBox mapper, available by pressing Ctrl + F1 in DOSBox. DOSBox Staging, allows you to remap the controller however you like, removing some limitations found with plain DOSBox (please reply if you run into difficulties with that!). My favourite mapping so far, which should work with no further configuration in both plain DOSBox and Staging, is a hybrid one: accelerator and brakes on buttons (as analog makes no difference for them), and steering on the left stick:

  • Joystick axis x-/+ (steering): left stick x-/+
  • Joystick axis y- (accelerator): A button
  • Joystick axis y+ (brakes): X button
  • Joystick button 1 (shift up): RB bumper
  • Joystick button 2 (shift down): LB bumper
  • Esc key (menu): Start button, or Y button

With the mapping done, select joystick input in the Stunts option menu, and perform the in-game calibration as usual.

Compared to the standard Stunts input devices, this hybrid setup is rather like an improved version of mouse controls (steering on x axis, accelerator and brakes on the buttons), free of the jerkiness that makes using the mouse so unwieldy.

Test drive

A natural thing to ask about using analog controllers in Stunts is whether the input is actually analog. After all, replay files store input in a digital format, a direct transcription of keyboard key presses. In the case of accelerator and brake input, there is indeed nothing analog about the input, even if you map an analog stick or trigger to the joystick y axis. As for steering, however, Stunts has a trick up its sleeve. In joystick mode, steering without moving the analog stick all the way left or right will keep the car wheel in an intermediate position as well. The game achieves that by sending key presses in the appropriate rhythm to keep the wheel roughly at the same place. That is demonstrated in the attached JOYTEST5.RPL, in which I spent more than a minute moving in circles, with the LM002 wheel held at one fifth of the way left.

What about actual driving, though? Though effective driving with non-keyboard controls will surely take a lot of getting used to, the first impression was far better than expected. After some warming up and acclimatising, for instance, I got the attached XBOX4.RPL: Default, Indy, classic line, 1:07.40. Slower than on keyboard, but a very normal lap, all things considered -- and the potential to improve is certainly there.

One difference between joystick and keyboard steering in Stunts is that with the joystick mode the movement range of the car wheel is only about half of what we get with a keyboard, presumably so that the analog steering wouldn't become too sensitive. That will probably mean a disadvantage in full powergear tracks and other scenarios which require extreme sliding tricks. On the other hand, I expect that it will be possible to put analog steering to good use in different situations, specially in OWOOT + NoRH driving.

(A practical detail worth mentioning: there seems to be a minor Stunts bug such that accelerating with joystick controls doesn't interrupt the leaving-the-truck animation. One way of skipping it without losing any time is holding the accelerator and then pressing shift down.)

Space and Enter

On a final note, these experiments made me think of a (perhaps obvious) hypothesis for why the keyboard controls have two pairs of keys for shifting (A/Z and Space/Enter). It sounds plausible that A/Z were originally meant as the "proper" shifting keys. However, as the two joystick buttons must handle both shifting and menu confirmation, it makes sense for a joystick button press to be translated to both. Given a reversible mapping, we'd end up with Enter (and Space) playing both roles on keyboard as well.

Overdrijf

Nice post!

This maps to my own findings. The information about how the game simulates the analog steering is very interesting.

With the limited movement for joysticks (or anything mapping to a jiystick) I feel like it was maybe always intended as maybe a bit more of a casual option. Easy to get into because of the reworked sensitivity, but limited by that very same adaptation.



One thing I can add about steering wheels (with pedals): because the controls were written for a joystick Stunts is looking to map forward and back to the same input. This makes it ignore the brake pedal completely, mapping brake to not pressing the gas pedal, forward to pressing it fully and not doing either to a stance in the middle.

This is not just a thing to get used to for driving, because the up and down keys are also used for navigating menus. Letting go of the gas completely while in a menu causes the game to scroll down continuously. Until you get the hang of using the pedal for navigation usung the menus looks like this: keep the pedal in the center and reach over to the mouse for actual navigation. Then for the final button you need to click to start driving you hover the mouse over the right option, put your hand back on the wheel and click with the shifting button. Don't press the accelerator before clicking or you're starting over.

Duplode

Quote from: Overdrijf on February 17, 2023, 07:29:25 AMOne thing I can add about steering wheels (with pedals): because the controls were written for a joystick Stunts is looking to map forward and back to the same input. This makes it ignore the brake pedal completely, mapping brake to not pressing the gas pedal, forward to pressing it fully and not doing either to a stance in the middle.

This sounds like it might be a wheel-to-Windows or Windows-to-DOSBox issue, rather than a DOSBox to Stunts one. How do the pedals show up in the Windows controller settings/testing?

Here are two other things you might want to try:

  • Setting joysticktype=fcs in dosbox.conf, and trying to remap the pedals with Ctrl + F1; and

  • Switching to DOSBox Staging, and trying to remap the pedals.

I have just done a quick test of the Xbox controller on Windows and plain DOSBox (from the R4K installer) and, given what I had read before, was pleasantly suprised at being able to map and use the analog triggers as accelerator and brakes. (There was one difference with respect to Linux, though: the triggers show up as the two sides of a single axis on Windows, while Linux had them as separate axes.)

Daniel3D

Im not a controller type, mostly because of lack of experience.
But what about,..

Right trigger and bumper for acceleration and break,
right thumb stick for steering. (right-hand responses are quicker)
Left trigger and bumper for shifting.

Back button Esc,
start button enter
A button to F1
B button to Free cam (F3?), set in preferred position
Y button to F2
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Erik Barros

Nice post, I was able to successfully use the Xbox one controller. I put the throttle and brake on the L2 and R2 buttons which are analog sticks on the controller, but it really doesn't make a difference. I was also able to successfully use a logitech G27 steering wheel, this one was very complicated to configure the accelerator and brake, in the logitech control they are different axes.

Overdrijf

#5
Quote from: Duplode on February 17, 2023, 02:22:22 PMThis sounds like it might be a wheel-to-Windows or Windows-to-DOSBox issue, rather than a DOSBox to Stunts one. How do the pedals show up in the Windows controller settings/testing?

You're right, it is a wheel-to-windows issue. It's trying to treat the brake pedal as the roll on an airplane or something. And it looks like it can't just be remapped by callibrating the thing. I'm going to look for some third party software or something to fix it.


EDIT: I've sort of almost got it. Dosbox doesn't even register the brake pedal as an input, but JoyToKey can map the brake pedal to a keyboard key (though not to a different controller input). Dosbox then claims it is mapping this keyboard key to the joystick brake movement, but somehow Stunts still detects it as a keypress instead of a joystick movement and refuses to configure the device because it stops configuring ones a button is pressed... :(

I may have just spent too little money and got myself some worthless old junk. Ah well, I bet I can find some game I can use it for.

Edit more: It works, it works! I had to remove the keys from their original function, and also make sure nothing I am actually using was doubly mapped.

Now the next problem: I suck at driving with a steering wheel.

Frieshansen

Thanks for the detailed report, Duplode!

It comes at just the right time for me. I've been testing different input options lately and after the entry about the attempts by you and Erik in the shoutbox I also ended up with a joypad. For me it became a PS4 pad because that's what's there right now.

Because putting the mouse on the analog axes doesn't work well, as you have already written (you always have to steer back manually), I drove digitally with this assignment (translated to the XBox-Controller):

  •     Arrow keys left/right (steering): D-pad left/right
  •     Arrow key up (accelerator): B button
  •     Arrow key down (brakes): A button
  •     A (shift up): Right trigger
  •     Z (shift down): Right bumper
  •     some other buttons for ESC, Enter, R, D

All my replays for the current track where driven with this setup.

I didn't know that the joystick, like the mouse, can also be steered analogously. I've tried it a few times now and it works really well.

Because of the limited movement range when steering: DOSBox Staging passes through the full analog range of the joystick (why shouldn't it - I tested it anyway). Found a good test program for such things and attached it. So there's probably nothing we can do about it. Interestingly you can use arrow keys up/down while joystick is active, but not left/right (who should ever need something like that :) ).

Daniel3D

There may be a piece of code that handles the joystick input, maybe one day we can rectify this issue.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Duplode

@Overdrijf Ah, good old JoyToKey! Too bad your nick doesn't have "a" or "z" in it; entering high scores would have been fun otherwise  :) (I do wonder if there isn't a driver for your wheel somewhere out there that would have it properly recognised. Looks like you won't need it for Stunts, but maybe for playing other games with analog pedals.)

@Daniel3D That could work too. At first I wondered if shifting with triggers would be awkward because of the different sensitivity, but it turns out that might even help a bit with avoiding double shifts on fast-shifting cars like the McLaren. There's no deep reason for most of the button assignments in my suggested layout -- it's mostly muscle memory from my days of PlayStation racing.

@Erik Barros Yeah, those things can be tricky to set up if you're unlucky. This reminds me of when I went the opposite way, trying (and failing) to use the Xbox controller with the triggers as analog substitutes for pedals in the wheel-first Grand Prix 4.

@Frieshansen Mapping to keyboard keys and keeping Stunts in keyboard mode is also a very reasonable way of using a gamepad, which should feel pretty close to regular digital input keyboard driving.

alanrotoi

Does it smells like a new wiki article? ::)

Overdrijf

#10
Quote from: Duplode on February 18, 2023, 02:02:16 AM@Overdrijf Ah, good old JoyToKey! Too bad your nick doesn't have "a" or "z" in it; entering high scores would have been fun otherwise  :) (I do wonder if there isn't a driver for your wheel somewhere out there that would have it properly recognised. Looks like you won't need it for Stunts, but maybe for playing other games with analog pedals.)

From what I can find online there was originally a driver on a CD that came with this thing. But even if it had still been with the one I got apparently it's useless on the current operating systems. More modern games apparently can just recognize the weird RZ-axis input natively so you can configure it as the brake in game.

Yeah, I got myself an oooold little bargain. Not nearly as old as Stunts though.



I actually didn't map a and z. Joystick 1 and 2 are already recognized as the space and enter equivalents. I did map those two to the shifter pedals on the back, but I did that in Dosbox. The complex roundabout mapping is just for the pedals. Pedal gas is mapped to "4" in JoyToKey (numbers are nice and out of the way for anything I do in Dosbox, even mostly for Carblaster, and JoyToKey can't simply map them to different controller inputs, just keyboard keys), which is then mapped to the joystick gaspedal in Dosbox. And the brake the same thing but through "3". Since gas and brakes aren't analog/gradated it now works like it should (I'm not noticing delays yet, at least...), it's just a little silly.

Shorty

Quote from: Frieshansen on February 17, 2023, 08:12:03 PMThanks for the detailed report, Duplode!

It comes at just the right time for me. I've been testing different input options lately and after the entry about the attempts by you and Erik in the shoutbox I also ended up with a joypad. For me it became a PS4 pad because that's what's there right now.

Because putting the mouse on the analog axes doesn't work well, as you have already written (you always have to steer back manually), I drove digitally with this assignment (translated to the XBox-Controller):

  •     Arrow keys left/right (steering): D-pad left/right
  •     Arrow key up (accelerator): B button
  •     Arrow key down (brakes): A button
  •     A (shift up): Right trigger
  •     Z (shift down): Right bumper
  •     some other buttons for ESC, Enter, R, D

All my replays for the current track where driven with this setup.

I didn't know that the joystick, like the mouse, can also be steered analogously. I've tried it a few times now and it works really well.

Because of the limited movement range when steering: DOSBox Staging passes through the full analog range of the joystick (why shouldn't it - I tested it anyway). Found a good test program for such things and attached it. So there's probably nothing we can do about it. Interestingly you can use arrow keys up/down while joystick is active, but not left/right (who should ever need something like that :) ).

It works just fine. Thank you all. Complete different driving experience.
¯\_(ツ)_/¯

alanrotoi

Quote from: Shorty on March 05, 2023, 09:31:29 PM
Quote from: Frieshansen on February 17, 2023, 08:12:03 PMThanks for the detailed report, Duplode!

It comes at just the right time for me. I've been testing different input options lately and after the entry about the attempts by you and Erik in the shoutbox I also ended up with a joypad. For me it became a PS4 pad because that's what's there right now.

Because putting the mouse on the analog axes doesn't work well, as you have already written (you always have to steer back manually), I drove digitally with this assignment (translated to the XBox-Controller):

  •     Arrow keys left/right (steering): D-pad left/right
  •     Arrow key up (accelerator): B button
  •     Arrow key down (brakes): A button
  •     A (shift up): Right trigger
  •     Z (shift down): Right bumper
  •     some other buttons for ESC, Enter, R, D

All my replays for the current track where driven with this setup.

I didn't know that the joystick, like the mouse, can also be steered analogously. I've tried it a few times now and it works really well.

Because of the limited movement range when steering: DOSBox Staging passes through the full analog range of the joystick (why shouldn't it - I tested it anyway). Found a good test program for such things and attached it. So there's probably nothing we can do about it. Interestingly you can use arrow keys up/down while joystick is active, but not left/right (who should ever need something like that :) ).

It works just fine. Thank you all. Complete different driving experience.

Cool! I'll try it too!