Jump to content

Fitts's law & mouse


Recommended Posts

Hi there,


so just now I was checking out youtube and my subscribed channels and one of my favourite among them posted this video:

https://www.youtube.com/watch?v=E3gS9tjACwU .

Immediately after seeing the title of it botting came up to my mind.


Basically they are talking about something called Fitts's law. It's represented by a formula which predicts time it takes human to get with mouse from point A to point B. it looks like this:


T = a + b * log2(A/W + 1)


T - time it takes to get from point A to B

a,b - not so significant variables, from the video I understood that they represent device you are using

A - altitude, distance between A and B

W - width of the target we are moving towards


After you watched the video ▼

Can we somehow use the formula they are mentioning to make client mouse movements more human-like? It wouldn't be hard to calculate those two variables they are mentioning (altitude and width) and get an average time it should get human to get from current mouse position to the destination. Then use that variable to set corresponding mouse speed. What do you guys think?

Edited by blabla123
Link to comment
Share on other sites

Yes, of course this is possible.

You would need to use a heuristic to accurately calculate the distance between A and B (just doing (diffx + diffy) is extremely unreliable since a mouse can move 8 different ways), take the Octile Heuristic:

distance = horizontalCost * (horizontal + vertical) + (diagonalCost - 2 * horizontalCost) * min(horizontal, vertical)


  • horizontalCost is the "cost" to move one tile left, right, up or down (in this example, it would be 10 as per the octile heuristic)
  • diagonalCost is the "cost" to move a diagonal (in this example, would be 14 as per the octile heuristic)
  • horizontal is the absolute value of (xstart - xend)
  • vertical is the absolute value of (ystart - yend)

Now, of course, this isn't completely accurate. The octile heuristic is a derivative of another heuristic which is the same, except it uses 1 for the horizontalCost and sqrt(2) for the diagonalCost. In an application like this, it may be wiser to use 1 & sqrt(2).

People also have faster or slower mouse speeds, this is just an estimate. If we followed the estimates perfectly, would it help us seem less bot-like?

Furthermore, this is more of an equation used for designers to see if their positioning is accurate or not - whether or not it is in an optimal position (T needs to be as little as possible)


Link to comment
Share on other sites

Yes but in this case we would have all the variables, because we know where the mouse is at the beginning and where it is moving - we use RectangleDestinations, or entity models, which have width and from those we can estimate AVERAGE time, which can then be randomized of course. So we would use the formula in reverse compared to "designers" if you'd like.


EDIT: As for the distance (this might be a stupid question but) why not just use pythagorean theorem? We have a grix of pixels, two points in this grid so why not just

distance = sqrt((x1 -x2)^2 + (y1 - y2)^2)

Where x1, y1 are coords of point A and x2, y2 are coords of point B.

Edited by blabla123
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...