Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DrJBN · Nov 24, 2021 at 09:45 AM · keyboardrepeating

Can keyboard repeat rate be detected?

I've got a game I use in research. As people learn that a light predicts an attacking spaceship, they start hitting a key associated with a weapon to charge it up before the ship appears. I'm using input.getkeydown to detect keystrokes. Typically I get response rates around 4-5 presses per second when they're prepping the weapon. But, today I got someone with rates up to 60 (framerate). I assume the person has their keyboard repeat rate and delay set to some values such that on each frame Unity thinks the key had been released and re-pressed and he/she is simply holding the key down. Is their any way I can detect those settings ahead of time?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Nov 24, 2021 at 11:11 AM

This has nothing to do with repeat rates since they are irrelevant for GetKeyDown. Those events only fire when a key is pressed down. The actual repeat rate of the keyboard / OS is only relevant for character input events in the UI / GUI system.


If you see 60 keydown events per second, the user most likely uses something like AutoHotKey or a keyboard that can simulate keypresses at those rates (usually even higher rates).


No, you can't really detect that as it doesn't need to be related to anything on the machine your game is running on. It could be an external hardware (like one of those programmable macro keyboads G15 G19, ...)


What you can do is restrict the max rate at which the user can actually execute that action by using a timer. Of course you have to pick a reasonable limit. Something like 15 clicks per second is probably a good limit. Barely anyone in the world is getting above 10 CPS. Though most games simply have some sort of penalty system when you click way too early or way too often. So if each click generates a score based on how far off they are from the correct moment, all those excess clicks would have a huge negative impact on the score.


Since this is for a research project I would simply hard limit the click rate as I said before. In other words if the delay between two clicks is smaller than a certain threshold for a couple of clicks, void the result. If this is actually part of a study, if you detect a cheater, I would actually reject this account completely because he would most likely try other means to cheat. Of course the detection has to be 99.9% certain. If this is for research studies there's no need to notify the user that he has been caught cheating. Just flag his results internally so you would not include them in the analysis.


Though we have no idea what this is actually about or what the users are actually supposed to do. If the goal is to spam the button as fast as they can, using a hard limit of 15 is probably the best solution. If more than 10 clicks in total are below that threshold or more than 4 consecutive clicks are below that threshold I would flag the results as invalid.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DrJBN · Nov 24, 2021 at 11:30 AM 0
Share

Thanks for that- I'll just chuck the ones I get that are clearly impossible & replace them. This is the first one I've got out of about 400 people.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

130 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Help with mobile keyboard 0 Answers

Keyboard to mouse click 0 Answers

How to you run a game in the background today? 0 Answers

Invoke.Repeating doesn't really "care" about repeat time? 1 Answer

How to start looped code (like that in Update()) from the area that runs once? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges