MickGyver / DaemonBite-Arcade-Encoder

An arcade controller project for the MiSTer FPGA project and any other device accepting USB HID joysticks. Up to 12 buttons are supported. Can also be used to create NeoGeo/Atari/Commodore/Amiga controller to USB adapters.
GNU General Public License v3.0
275 stars 47 forks source link

How do you measure input delay? #11

Closed nebhead closed 3 years ago

nebhead commented 3 years ago

Not an issue, just curious how you are measuring input delay on this project. I'd put together my own arcade stick example a couple of years back (link to the commit here) as a fork of someone else's project and I'd like to know how well it works compared to this one. Yours looks much cleaner and I may consider switching over. (also, expect some traffic here as someone has posted a video using your project to Reddit - consider setting up discussions on this repository) Nice work!

0x15e commented 3 years ago

I'm 99% sure he's using Porkshop's MiSTer latency tester core / procedure. You can find more info about the procedure and aggregated results here (check all the different sheets for the results): https://docs.google.com/spreadsheets/d/1KlRObr3Be4zLch7Zyqg6qCJzGuhyGmXaOIUrpfncXIM/edit#gid=369482991

I tried some other Arduino / STM32 firmwares (including Freejoy but not sure if I tried the one you linked) and DaemonBite was so much faster than everything it wasn't even funny.

Especially impressive is the way debounce is implemented. Without debounce, many arcade controls such as the IL Eurostick and Happ buttons will trigger multiple times per activation so you really need it in the arcade adapter. When I tested Freejoy, whatever time you configure for debounce was basically added to the input latency ... so like 15-20ms. It was nuts. DaemonBite does it differently so that enabling debounce is practically free (it still adds a super tiny time to latency but it's negligible).

nebhead commented 3 years ago

Outstanding, thanks for the response. This is very comprehensive data. I'm relatively positive daemonbite is better than the code I linked above because my debounce is 10ms at a minimum.

Well, looks like I'm going to have a fun weekend project to do on my arcade. :) Honestly though, it should be really simple to get this implemented with my current setup so I'm excited to give it a go.

MickGyver commented 3 years ago

Especially impressive is the way debounce is implemented. Without debounce, many arcade controls such as the IL Eurostick and Happ buttons will trigger multiple times per activation so you really need it in the arcade adapter. When I tested Freejoy, whatever time you configure for debounce was basically added to the input latency ... so like 15-20ms. It was nuts. DaemonBite does it differently so that enabling debounce is practically free (it still adds a super tiny time to latency but it's negligible).

I'm quite proud of my debounce logic, I haven't seen it anywhere else, usually debouncing adds a lot of lag. My way of doing it is ignoring button changes for 10ms after a change has occured, this means that a button can't change state more often than 10ms but it is basically physically impossible to do that anyway.

nebhead commented 3 years ago

@MickGyver - You should be proud. :) It does work really well and is definitely an upgrade over the code that I was using before. I wasn't planning on updating my arcade cabinet until the weekend, but I got a little too excited and stayed up late last night to get it working. It worked flawlessly, first time, and is very responsive. Even the X-Y is much more responsive than my previous implementation. Well done!

I wanted to mention that I also followed the guidance at the end of this video: https://www.youtube.com/watch?v=hoCOq9Ngp44 (@19:17), to rename the USB devices to 'DaemonBite (Player 1)' and 'DaemonBite (Player 2)'. This is extremely useful for my setup in the cabinet where it's hard to discern between the different controllers, especially when it's all closed up. Hopefully that helps someone else here.