Good exponential algorithm for mouse acceleration

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Jezze
Member
Member
Posts: 395
Joined: Thu Jul 26, 2007 1:53 am
Libera.chat IRC: jfu
Contact:

Good exponential algorithm for mouse acceleration

Post by Jezze »

Hi,

I'm trying to find a good algorithm for mouse acceleration during mouse movement. Any good ideas?
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Good exponential algorithm for mouse acceleration

Post by bluemoon »

Do you consider threshold method good?
User avatar
Jezze
Member
Member
Posts: 395
Joined: Thu Jul 26, 2007 1:53 am
Libera.chat IRC: jfu
Contact:

Re: Good exponential algorithm for mouse acceleration

Post by Jezze »

I haven't tried it. Sounds like it could work. Previously I've tried to apply different algorithms on the entire span from slowest movement to largest and noticed that it didn't really feel very good, it was either to slow in high speed or to quick in low speed. I never thought about having a threshold where if the mouse reports a movement larger than the threshold it will start to accelerate.
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Good exponential algorithm for mouse acceleration

Post by bluemoon »

AFAIK DOS, Windows and probably mac os uses threshold and user configurable speed (2x, 3x, 4x, etc).
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Good exponential algorithm for mouse acceleration

Post by Nessphoro »

From a gamer's perspective:
Acceleration is total trash
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Good exponential algorithm for mouse acceleration

Post by Owen »

Nessphoro wrote:From a gamer's perspective:
Acceleration is total trash
From everyone else's perspective, (and many gamers, e.g. those who play RTS games) acceleration is a great thing.

But, then again, game types which don't want acceleration are those for which there shouldn't be a mouse pointer to accelerate anyway (e.g. an FPS should be listening for raw mouse events, not pointer movements.

(and the merits of pointer acceleration in FPS and similar games are still somewhat debatable)
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Good exponential algorithm for mouse acceleration

Post by Nessphoro »

I am afraid I must disagree.
In FPS I prefer having the acceleration on as it allows for a faster twitch response.
In RTS, however, I prefer to have it off. For example in Starcraft, microing units with acceleration on would result in many miss-clicks.
And I'm sure that a big portion of the community( TeamLiquid that is, not OSDev) will agree.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Good exponential algorithm for mouse acceleration

Post by bewing »

Engineers have done countless studies on human feedback. The basic rule is that feedback (and mouse acceleration is a form of feedback) should always be logartihmic -- because that provides the best "feel". That is why I suggested in the mouse wiki article to use the BSR opcode to calculate an approximate log base 2 of (deltax + deltay).
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Good exponential algorithm for mouse acceleration

Post by bluemoon »

You realize "acceleration off" is a subset of threshold set to 255 (the max value of a movement packet, or otherwise the max movement of a sampling period)? The proper implementation should include threshold value, acceleration factor and perhaps acceleration function (linear, log, etc).
Post Reply