ScummVM lag with joystick control
-
Is anyone else experiencing lag when using a joystick as a controller in ScummVM? For simple input games like the Humongous kids games (Putt-Putt, Pajama Sam, Spy Fox, Freddi Fish) it's the perfect input device as you only move the cursor around and click on items also you can exit with the controller only.
In the previous version of ScummVM (RetroPie 3.6 version) it worked fine but in the new version it lags and then warps to catch up. I tried several games and it seems to be universal it's an issue that was introduced with the new version of ScummVM 1.8.
-
@Riverstorm try an analogue stick or a mouse. SDL2 handles input differently
-
@BuZz said in ScummVM lag with joystick control:
@Riverstorm try an analogue stick or a mouse. SDL2 handles input differently
Sorry, the information was incomplete. I am using a XBOX 360 controller with wireless dongle. It seems to register the left analog stick (as the mouse) which worked perfectly in previous versions but not so in the new version.
When I use a regular mouse it works flawlessly so it seems something changed from the previous version and it's only an issue with joysticks.
Not that I understand it really but the new version uses SDL2 is the change?
-
correct. Works ok on my xbox controller analogue stick though when I last tested.
-
I also have the same problem with the lag on my xbox controller. If I use the keyboard with trackpad no issues. The xbox controller worked fine on the last version but after upgrading not so much.
-
@BuZz said in ScummVM lag with joystick control:
correct. Works ok on my xbox controller analogue stick though when I last tested.
Yeah for sure it works it just warps around sometimes small jumps and other times large jumps playing catch up. It's pretty annoying as you always distracted by the cursor warping around with a small delay. The same as Bassman it worked with no issues in previous version of ScummVM (RetroPie 3.6).
I have about 36 games installed so I don't think that would be an issue. I don't know what other relevant information might be helpful in troubleshooting the issue. I am using RetroPie Setup to load the driver with 4 players. I'm using 4 wireless XBOX 360 joysticks with the official Microsoft wireless dongle.
I did notice in the RetorPie Setup under Setup / Configuration | Option 829 Xbox / Xbox 360 gamepad driver. If you set number of controllers to enable = 4, enable the driver and reboot it works fine for 4 players. If you go back in the settings and look at the number of controllers you enabled it always shows (currently 2). It always changes back to 2. Maybe that's by design but it would be more intuitive if it remembered how many players you originally configured. I don't think that has anything to do with it but just trying to figure out the issue as ScummVM is a must.
-
@bassman6805 said in ScummVM lag with joystick control:
I also have the same problem with the lag on my xbox controller. If I use the keyboard with trackpad no issues. The xbox controller worked fine on the last version but after upgrading not so much.
I think I found my issue.
Try adding this line to /boot/cmdline.txt:
usbhid.mousepoll=0I set mine to usbhid.mousepoll=2 so I could use a spinner that's sampling at 1200Hz. In games like Tempest you start back spinning because the resolution rate is so high on the spinner.
The XBOX 360 controller which is sampling I believe at 1000Hz. So slowing down the sample rate was throwing off ScummVM as the analog stick works as a mouse.
The polling rate of a device is measured in Hertz (Hz) and is determined by the polling interval. The polling interval is measured in milliseconds (ms) and equates to lag time.
The default polling interval is 10ms. However, USB controllers round the interval down to the nearest power of two. Thus, an interval setting of 10ms will actually use 8ms, 7ms will use 4ms, etc.
The table shows the relation between polling rate Hertz and the corresponding interval milliseconds (rate = 1000 / interval).
If the polling rate is 125 Hz, the mouse position will be updated every 8 milliseconds. In situations where lag is critical—for example games—some users decrease the interval to as little as possible. However, this puts more load on the CPU, so care should be taken when adjusting this value.
Hz 1000 500 250 125 ms 1 2 4 8
I am not sure how to get around that as the spinner is using raw mouse input. Some experimentation might find a balance or you can't use both a spinner and joystick in the same build unless it's sampling at a lower rate.
-
Yeah, I'm using retropie 3.7 and I've had the warping mouse pointer issue forever. Works fine with mouse. Using a joystick with analog, it's just as you say. It's like the Pi is only polling the controller position every once in a while. When it finally does, the mouse warps to it. Making games nearly impossible to play.
I tried the "usbhid.mousepoll=0", I tried setting it to every number between 0 and 8. I tried changing ScummVM render resolution. Changing screen modes. I even did some strange command-line hack trying to fix it. (I can't remember where or what it was, now) but I still can't play ScummVM games with joystick :(
-
You might consider mapping a virtual mouse to the analog stick for use here. The movement is smooth as silk. I'm currently working my way through the original Commodore 64 release of 'Maniac Mansion' on ScummVM and although nothing beats an actual mouse, not having to put your controller down to play these games is a great novelty.
-
@mediamogul
That sounds interesting, can you describe how you do that on RetroPie?
Can I also map F1 to any controller button to enter the menu? -
Sure. There are a couple of ways to do it, but I use xboxdrv. You can install that from the RetroPie setup menu if you are interested. I've got to head out for the day, but I'll leave you with a guide to get you started and the additional commands to do what you want to do. The guide I originally used is at:
https://steamcommunity.com/app/221410/discussions/0/558748653738497361/
Once you map your controller, you would just add these arguments:
--ui-axismap x1=REL_X:10,y1=REL_Y:10
--ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT
That will effectively map a virtual mouse to the left joystick, as well as the left & right mouse buttons to the a & b buttons. I like to consolidate my main joystick map with the mouse mapping, so I use a hotkey setup to only enable mouse functions with a modifier key. Using the 'Start' button as that modifier would look like this:
--ui-axismap start+x1=REL_X:10,start+y1=REL_Y:10
--ui-buttonmap start+lb=BTN_LEFT,start+rb=BTN_RIGHT
Lastly, mapping F1 to a button (Let's use the 'Select' button as an example) would look like this:
--ui-buttonmap select=KEY_F1
You can launch these mappings in many different ways. I have my main mapping launched automatically when the controller is detected using a udev rule and my alternate mappings I have made select-able from the 'RetroPie' menu of Emulation station. I'm currently putting together a full guide on how to do all this stuff, it's just that there are so many use case scenarios and possibilities and I'm trying to sort it into sections of interest.
Again, this is just how I do it. There are other ways, but xboxdrv is so versatile, I prefer it to be a one-stop universal joystick calibration solution. I hope this helps and I'll be back around later tonight if you have any questions.
-
I'm also having this lagging problem with joystick output. I'm guessing mapping the Xbox driver to act as a mouse would interfere with all the other emulators installed on RetroPie, as clever a get around as it is?
There's an additional problem I'm having with Zork: Grand Inquisitor, in that I'd like to be able to access it via a joypad type controller (Xbox 360/PS3 standard) - but I can't exit the game. Some Scumm games allow you to pull up a ScummVM menu (e.g. Monkey Island - using the RB button). This allows you to quit the game. Zork doesn't have this.
Is this more something to post on the ScummVM forums I suppose?
Would be great to see a virtual keyboard be introduced to this too.
-
@OneSwitch said in ScummVM lag with joystick control:
I'm guessing mapping the Xbox driver to act as a mouse would interfere with all the other emulators
Using a modifier button as seen in the above example is one way around that. However, that means that you constantly need to be pressing a button to use the mouse. I mainly use that configuration for Amiga, Macintosh and DOS games, as they only need the occasional mouse input. Anyone aiming to use a single set of gamepad controls throughout all the emulators included with RetroPie will never find a perfect all-in-one solution. I've settled on a series of scripts that I launch from the Emulation Station menu that reconfigure my controller to whatever scenario I need. When I want to play ScummVM games, I select and launch a script that maps mouse movements to the left thumbstick as it's primary action. When I'm done, I simply launch my main configuration for general use.
There is also a way to have a controller configuration of this kind automatically launch and exit alongside the chosen emulator. To do that, you would map your controller in the same way that is shown in the steam link above, adding only a path to the desired emulator as the last argument to xboxdrv. The description below details how to accomplish this automatic mapping in a shell script. However, the same command would rather be added to an emulator's launch command in RetroPie in order to launch and exit the mapping when a game is selected for play. After that's configured once, the end user would never know anything was happening other than the desired control scheme would "just work" and the original control scheme would return when the emulator exits, making it a completely transparent solution.
From: http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html
When you want full game specific configurability and automatic launching of xboxdrv, it is easiest to write little startup scripts for your games that will launch xboxdrv, launch your game and then when the game is finished tear down xboxdrv:
#!/bin/sh exec xboxdrv \ --trigger-as-button -s \ -- \ your_favorite_game # EOF #
Here your_favorite_game is the executable of your game and is passed to xboxdrv as last argument. This will cause xboxdrv to start the game and keep running as long as the game is running, when the game is done, xboxdrv will quit automatically.
If you want to pass parameters to the game you have to add a -- separator, as otherwise your options to the game would be eaten up by xboxdrv.
-
Thanks for all this. I like the idea of a script kicking in to make ScummVM smooth and accessible via a joypad controller (with a few additional key-commands available too), then releasing control upon exit. I'll give this a go ASAP. Thank you. This might especially be useful as Zork Grand Inquisitor has no joypad method to exit the game.
-
@OneSwitch said in ScummVM lag with joystick control:
with a few additional key-commands available too
Yeah, I forgot to mention that my ScummVM mapping also includes left and right mouse clicks as buttons 'A' and 'B', along with 'F5' being mapped to the start button to bring up the options menu. It's a very comfortable setup and makes playing these games from a controller feel much more natural.
This might especially be useful as Zork Grand Inquisitor has no joypad method to exit the game.
That's a great idea and should work well.
-
Has anyone figured out just a quick fix for this? On my Pi 2 everything ran perfect with ScummVM, but now with a Pi 3 and 4.0, the 360 controller lags horribly for this, and makes point and click games (with the controller) unbearable! I don't want to go about mapping things, as I'm making this for my younger brother and I don't want him to have to worry about fixing it or changing it if he wants to play other games and no mouse/keyboard either would be nice, just wireless 360 controllers.
-
@Dominus said in ScummVM lag with joystick control:
Has anyone figured out just a quick fix for this? On my Pi 2 everything ran perfect with ScummVM, but now with a Pi 3 and 4.0, the 360 controller lags horribly for this, and makes point and click games (with the controller) unbearable! I don't want to go about mapping things, as I'm making this for my younger brother and I don't want him to have to worry about fixing it or changing it if he wants to play other games and no mouse/keyboard either would be nice, just wireless 360 controllers.
I haven't found an simple solution for this. You said you don't want to use mapping, but I followed the tutorial from @mediamogul and had it working in a bit more than an hour. ScummVm now works perfectly without "fixing and changing" anything. No conflicts with other emulators too.
Here's the link th the thread:
https://retropie.org.uk/forum/topic/2861/guide-advanced-controller-mappings -
Has anyone tried to just put the old ScummVM onto Pi? Is that even possible? I just don't understand how it can work great with the previous version, now it lags horribly and is unplayable?
-
@Dominus I copied a ScummVM binary, version 1.7.0, from a previous RetroPie build to replace the latest one, version 1.8.1. I'm using a PS3 controller and version 1.7.0 works fine.
In building version 1.7.0, I had edited the code to remap the buttons for the Dualshock so using the old binary just seems the easiest solution for now.
-
@dudleydes I use a 360 wireless controller so I should just be able to copy the binary from a previous install, install it and be good?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.