Could input lag from controllers be eliminated without special new hardware?

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 4:30 am

Just wondering, could doing something like increasing the USB polling rate get rid of input lag without requiring new hardware?

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 5:14 am

Can you actually feel the input lag? What controller are you using? What monitor are you using? Input lag on MiSTer is not really perceptible on 8bitdo/Retro-bit 2.4ghz controllers with Game Mode monitor /CRTs. I have a feeling your setup has something in the chain that is adding to the lag.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5807
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Could input lag from controllers be eliminated without special new hardware?

Postby Sorgelig » Fri Nov 22, 2019 5:23 am

Couple recent commits in Kernel are to increase input lag. Probably not all gamepads can benefit from this, but it's definitely decrease the "lag" for some gamepads.
Custom interfaces are not required. Especially with USB you have much more flexibility.

User avatar
rsn8887
Atariator
Atariator
Posts: 28
Joined: Mon Nov 11, 2019 7:20 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby rsn8887 » Fri Nov 22, 2019 5:51 am

You probably meant to say decrease input lag, not increase?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5807
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Could input lag from controllers be eliminated without special new hardware?

Postby Sorgelig » Fri Nov 22, 2019 6:38 am

increase polling rate -> decrease the input lag.

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 7:41 am

Oops double post, please delete.
Last edited by RabidWookie on Fri Nov 22, 2019 7:45 am, edited 1 time in total.

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 7:43 am

RabidWookie wrote:
crocky wrote:Can you actually feel the input lag? What controller are you using? What monitor are you using? Input lag on MiSTer is not really perceptible on 8bitdo/Retro-bit 2.4ghz controllers with Game Mode monitor /CRTs. I have a feeling your setup has something in the chain that is adding to the lag.


I can feel a very slight difference between using my xbox 360 fightstick via a USB port and using it wired directly to a padhacked original Sega Genesis 6 button controller via blisster LLAPI port on a core that supports LLAPI. I've been playing on a Trinitron 480i CRT. The input lag is very slight, and nothing like emulation input lag, but noticeable in certain games that require fast twitch reactions. I'd love to see a standardized open source method of eliminating all input lag, especially for things like light gun games and twitch games.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 8:38 am

Please note that all gamepads in general have different circuitry, and can have more or less lag regardless of the usb polling rate. Classic example is my VLX Kuro fightstick which looks great but the encoder PCB itself is laggy.

Check this out:
http://www.teyah.net/sticklag/results.html

Check if your fight-stick is mentioned there, but comparing a X360 controller with a Sega 6 Button/SNES/NES controller could be wrong simply because the Sega 6 button PCB would most probably be lag free. I use a Mayflash Sega 6 Button controller to USB convertor for the time being from my earlier gaming PC setup and not sure I feel missing inputs or lag.

Also before you invest all out in the HDMI cables please remember that you are investing in zombie hardware (old controllers) and they wont last forever. I agree with you we need some other open source solution ideally usb so we can use newer hardware gamepads like 8bitdo and Retrobit or other that manufacture modern hardware and care about input lag etc.

Dubon
Atariator
Atariator
Posts: 28
Joined: Fri Oct 26, 2018 4:01 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby Dubon » Fri Nov 22, 2019 2:23 pm

Why use the sega controller. Couldnt you just mod with db15?

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 8:58 pm

Its not possible to get USB as low or as consistent as something like SNAC, but with 1ms polling and the right controller you can get really good results. The problem is making sure you have a good USB controller because input lag varies per controller. With 1ms polling the M30 2.4ghz average around just under 2ms of input lag where M30 BT hits around 7ms, this is wired results mind you. More testing needs to be done to seperate the good from the bad.

Anyways, if you are a speedrunner where every Ms counts then just stick with SNAC. USB with 1ms polling and a good controller is likely good enough for most people though.

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 9:51 pm

Dubon wrote:Why use the sega controller. Couldnt you just mod with db15?


I wired up this fightstick 10 years ago to work on every console possible (xbox 360 pcb dual modded with MC Cthulhu + an A/B switch to divert the controls to a DB25 port for connecting to padhacked controllers). I was extremely disappointed to learn after the fact through trial and error to learn that the MC Cthulhu isn't fully compatible with the entire SNES and NES library so I had to padhack those too. Is the Sega Genesis controller direct wired in a way where padhacking is unnecessary?

The xbox 360 fightstick PCB is said to have about 7ms of lag, so that is a component of it for sure when added to the 8ms of lag I've heard USB polling generates on MiSTer.

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 9:54 pm

SegaSnatcher wrote:Its not possible to get USB as low or as consistent as something like SNAC, but with 1ms polling and the right controller you can get really good results. The problem is making sure you have a good USB controller because input lag varies per controller. With 1ms polling the M30 2.4ghz average around just under 2ms of input lag where M30 BT hits around 7ms, this is wired results mind you. More testing needs to be done to seperate the good from the bad.

Anyways, if you are a speedrunner where every Ms counts then just stick with SNAC. USB with 1ms polling and a good controller is likely good enough for most people though.


Is SNAC open source, and will it be possible to use one controller for all cores?

Is MiSTer usb polling currently only generating 1ms of input lag, and is that enough for light gun compatibility? I thought you had to buy a blisster and use LLAPI to get down to 1ms or less of input lag.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 10:52 pm

Before you people blame the hardware for having high latency few things to keep in mind:

A 60hz game has a 16ms blanking interval when it polls - so likely you arent getting any benefit out of the so called 1ms LLAPI.

Also check your reaction time and see how much is your capacity to respond to in ms. Anything less than 10ms on this test you might as well save your money and stick to normal controllers with fast PCBs.
https://www.humanbenchmark.com/tests/reactiontime

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 10:59 pm

crocky wrote:Before you people blame the hardware for having high latency few things to keep in mind:

A 60hz game has a 16ms blanking interval when it polls - so likely you arent getting any benefit out of the so called 1ms LLAPI.

Also check your reaction time and see how much is your capacity to respond to in ms. Anything less than 10ms on this test you might as well save your money and stick to normal controllers with fast PCBs.
https://www.humanbenchmark.com/tests/reactiontime



LLAPI is tied to console polling, USB is not. With USB you'll always have some percentage of your input missing a frame where as with LLAPI that shouldn't happen. 1ms USB polling with the right controller just makes it lose a frame less often. LLAPI still has the advantage and will always have it.

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 11:05 pm

RabidWookie wrote:
SegaSnatcher wrote:Its not possible to get USB as low or as consistent as something like SNAC, but with 1ms polling and the right controller you can get really good results. The problem is making sure you have a good USB controller because input lag varies per controller. With 1ms polling the M30 2.4ghz average around just under 2ms of input lag where M30 BT hits around 7ms, this is wired results mind you. More testing needs to be done to seperate the good from the bad.

Anyways, if you are a speedrunner where every Ms counts then just stick with SNAC. USB with 1ms polling and a good controller is likely good enough for most people though.


Is SNAC open source, and will it be possible to use one controller for all cores?

Is MiSTer usb polling currently only generating 1ms of input lag, and is that enough for light gun compatibility? I thought you had to buy a blisster and use LLAPI to get down to 1ms or less of input lag.



SNAC is open source and part of the Main MiSTer cores for NES and SNES. Its required if you want to use an original NES light gun.

Currently main mister isn't polling at 1ms, its more like 4ms+. The 1ms polling commit was just approved. If you want to try out 1ms polling you have to add two files in your linux folder. And it must be stressed that not every controller is gonna hit 1ms of latency, that is only best case scenerio. Plenty of controllers still have well over 7ms of latency even with 1ms polling.

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 11:12 pm

SegaSnatcher wrote:
crocky wrote:Before you people blame the hardware for having high latency few things to keep in mind:

A 60hz game has a 16ms blanking interval when it polls - so likely you arent getting any benefit out of the so called 1ms LLAPI.

Also check your reaction time and see how much is your capacity to respond to in ms. Anything less than 10ms on this test you might as well save your money and stick to normal controllers with fast PCBs.
https://www.humanbenchmark.com/tests/reactiontime



LLAPI is tied to console polling, USB is not. With USB you'll always have some percentage of your input missing a frame where as with LLAPI that shouldn't happen. 1ms USB polling with the right controller just makes it lose a frame less often. LLAPI still has the advantage and will always have it.


So LLAPI is lag-free compared to original hardware?

RabidWookie
Atari maniac
Atari maniac
Posts: 77
Joined: Sun Oct 27, 2019 6:23 am

Re: Could input lag from controllers be eliminated without special new hardware?

Postby RabidWookie » Fri Nov 22, 2019 11:14 pm

crocky wrote:Before you people blame the hardware for having high latency few things to keep in mind:

A 60hz game has a 16ms blanking interval when it polls - so likely you arent getting any benefit out of the so called 1ms LLAPI.

Also check your reaction time and see how much is your capacity to respond to in ms. Anything less than 10ms on this test you might as well save your money and stick to normal controllers with fast PCBs.
https://www.humanbenchmark.com/tests/reactiontime


1 frame of additional input lag definitely matters with certain types of twitch games and light gun games.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 11:20 pm

SegaSnatcher wrote:
crocky wrote:LLAPI is tied to console polling, USB is not. With USB you'll always have some percentage of your input missing a frame where as with LLAPI that shouldn't happen. 1ms USB polling with the right controller just makes it lose a frame less often. LLAPI still has the advantage and will always have it.


USB polling can't be tied to console polling? Regarding the input missing a frame, I play original CPS1/2 using my USB controller through a USB to DB15 adaptor and I dont get any missing inputs. I have however seen missing inputs on software emulators with the same stick.

LLAPI always having an advantage is an odd thing to say - its piece of a code which is closed source and functionality can be replicated if someone really wants to, and its a matter of time.

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 11:22 pm

RabidWookie wrote:
SegaSnatcher wrote:
crocky wrote:Before you people blame the hardware for having high latency few things to keep in mind:

A 60hz game has a 16ms blanking interval when it polls - so likely you arent getting any benefit out of the so called 1ms LLAPI.

Also check your reaction time and see how much is your capacity to respond to in ms. Anything less than 10ms on this test you might as well save your money and stick to normal controllers with fast PCBs.
https://www.humanbenchmark.com/tests/reactiontime



LLAPI is tied to console polling, USB is not. With USB you'll always have some percentage of your input missing a frame where as with LLAPI that shouldn't happen. 1ms USB polling with the right controller just makes it lose a frame less often. LLAPI still has the advantage and will always have it.


So LLAPI is lag-free compared to original hardware?


Basically from what I hear even original hardware can miss a frame but its a rare occurance. LLAPI on a technical level is gonna be closer to OG controller polling than USB, but SNAC is 1:1.

With M30 2.4Ghz controllers wired and with 1ms USB polling you'll have like a 4% chance of missing a frame. Its really low, but not quite as good as LLAPI. Majority of people won't likely notice a difference, but speedrunners might.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 11:25 pm

SegaSnatcher wrote:
RabidWookie wrote:
SegaSnatcher wrote:Basically from what I hear even original hardware can miss a frame but its a rare occurance. LLAPI on a technical level is gonna be closer to OG controller polling than USB, but SNAC is 1:1.



Show us the experiments with the data.

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 11:26 pm

crocky wrote:
SegaSnatcher wrote:
crocky wrote:LLAPI is tied to console polling, USB is not. With USB you'll always have some percentage of your input missing a frame where as with LLAPI that shouldn't happen. 1ms USB polling with the right controller just makes it lose a frame less often. LLAPI still has the advantage and will always have it.


USB polling can't be tied to console polling? Regarding the input missing a frame, I play original CPS1/2 using my USB controller through a USB to DB15 adaptor and I dont get any missing inputs. I have however seen missing inputs on software emulators with the same stick.

LLAPI always having an advantage is an odd thing to say - its piece of a code which is closed source and functionality can be replicated if someone really wants to, and its a matter of time.


Based on comments from a few devs, no you can't tie USB to console polling or vblank.

LLAPI is not closed source. LLOAD is an open source project using LLAPI code.

When I say missed inputs I'm not saying you press a button and nothing happens, what I mean is sometimes when you push a button it won't react within the same time frame as the initial drawn frame and will register at the nest frame which is where the 1 frame of lag comes in.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 11:28 pm

SegaSnatcher wrote:
crocky wrote:
SegaSnatcher wrote:

LLAPI is not closed source.


It is, no point going further with discussion for me if you are not aware that LLAPI is closed source.

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 11:36 pm

crocky wrote:
SegaSnatcher wrote:
RabidWookie wrote:



Show us the experiments with the data.


unknown (2).png


Quote from Ulao, he understands this and explains it better more than I could.

"The idea of LLAPI is to use the cores latch mechanism or polling system to grab the button payload of the controller. It is not designed to be low latency or fast per se, it just happens to be that way inherently. The concept of LLAPi simply was to latch on to the controller when the console, or game wanted that done. So, we are taking the responsibility away from the OS to poll the controller and giving it to the core.

See the timing chart to get an idea of when things occur

USB at 1ms has a very good chance of falling in the pit where the LLAPI is to achieve the same effect but could still fall outside. It is important to know that USB will never be in sync to the v-blank where LLAPI is by its design. Also, from the image you can clearly see why LLAPI can take it’s time, up to 16ms because nothing is going to happen when the screen is painted. The only thing that matters is when the poll takes place. So, syncing it is always best. NOTE: Some and many controllers will take more then 1ms to read the payload so the 1ms USB poll rate is clumsy. A good example is PlayStation and the pressure data. The PSX controller itself takes 4ms to get data to the console and an addition 12ms to get pressure data using its ISP like interface. LLAPI will do that with zero lag (if you fail to understand why, you didn’t understand the first paragraph). The actually PS2 console polls the controller at 16ms. You never feel lag because the console ties the poll rate to v-blank. You will never do that in an OS (period). Though with something like the MiSTer and working in the CORE’s you can.
You do not have the required permissions to view the files attached to this post.

SegaSnatcher
Atari User
Atari User
Posts: 38
Joined: Sun Oct 13, 2019 12:34 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby SegaSnatcher » Fri Nov 22, 2019 11:39 pm

crocky wrote:
SegaSnatcher wrote:
crocky wrote:LLAPI is not closed source.


It is, no point going further with discussion for me if you are not aware that LLAPI is closed source.


Sorry, you are confused. LLAPI is not closed source, if it was then LLOAD wouldn't be possible, please do more research. Blisster is closed source, not LLAPI.

crocky
Atari maniac
Atari maniac
Posts: 98
Joined: Fri Nov 23, 2018 2:01 pm

Re: Could input lag from controllers be eliminated without special new hardware?

Postby crocky » Fri Nov 22, 2019 11:44 pm

I suggest you do the research about the LLAPI code's license. Better yet, share the LLAPI source code link. Also quoting the creator of the protocol and using his explanation in place of experimental data is not adding to anything to this thread than advertising his product.


Return to “MiSTer”

Who is online

Users browsing this forum: gargoyle67 and 20 guests