Jump to content
Wanted

Random point in box not human enough?

Recommended Posts

Currently things like mousebox generate a random point within a box with an equal chance of every point in the box being used.

 

Humans have a higher frequency to click closer to the center.

 

It may give us a considerable human like edge to employ an algorithm that utilizes this idea.

 

Is it a good idea?

Is there more that can be added to the idea?

In what way should we add user customization?

Are there any other related ideas?

How hard would this be to do?

What would the algorithm look like?

 

Discuss

Link to comment
Share on other sites

Yeah it is a good idea, something like that but also you want, for it to click them not so centred bits on occasions. Miss clicking on purpose is good or move somewhere around the box before then moving inside the box.

 

On a side note, speed of mouse to me is a big thing in human likeness. Humans will always slow down slightly when moving to what they want to click on. So if you could even change mouse speed randomly while moving would be more human like.

Link to comment
Share on other sites

I'd like this :)

 

I'd also like to have a different Mouse...() poricedure for each interface on runescape, like MouseNPC() would have to have fairly fast mousespeed in order to click the NPC before it escapes the x,y but MouseGameTab() wouldn't have to have a fast mouse speed because gametabs doesn't move in any way

Link to comment
Share on other sites

I'd like this :)

 

I'd also like to have a different Mouse...() poricedure for each interface on runescape, like MouseNPC() would have to have fairly fast mousespeed in order to click the NPC before it escapes the x,y but MouseGameTab() wouldn't have to have a fast mouse speed because gametabs doesn't move in any way

 

This I'd like to :)

Link to comment
Share on other sites

Yeah it is a good idea, something like that but also you want, for it to click them not so centred bits on occasions. Miss clicking on purpose is good or move somewhere around the box before then moving inside the box.

 

On a side note, speed of mouse to me is a big thing in human likeness. Humans will always slow down slightly when moving to what they want to click on. So if you could even change mouse speed randomly while moving would be more human like.

 

It would be an algorithm that has a value between 0.00.. and 1 customizable to frequency of central-ness. Some high end math would be involved, I may need slight help here.. if not I'm going to have to do some research.

 

Addressing the mousespeed/other ideas is a topic for another thread. So if you want to keep talking about that feel free to make another discussion in feedback.

 

However I will say that miss clicking is far from easy in case by case uses and most likely impossible in standardization meaning it will likely have to be something the end user designs and employs.

 

Regarding mouse speed is probably a good idea to have an extra /RS2/ specific mouse or perhaps in /Extended/ ....

 

Both topics for another thread.

 

I'd like this :)

 

I'd also like to have a different Mouse...() poricedure for each interface on runescape, like MouseNPC() would have to have fairly fast mousespeed in order to click the NPC before it escapes the x,y but MouseGameTab() wouldn't have to have a fast mouse speed because gametabs doesn't move in any way

 

I had the same thought with the different mouse speed uses. But topic for a separate thread

 

[/semiofftopic]

 

[ontopic]

 

I have moved things like the method for random box point and random circle point to Divi\Math\ as RRectanglePoint and RCirclePoint so that's where the algorithm would be placed and affect the functions using them globally.

 

What remains is

 

the default 0.00.. - 1 global variable value and the actual MATH needed for the alg itself.

 

Hmm...

 

/goesintoendlessresearch

 

Some help would be helpful :P

Link to comment
Share on other sites

It would be an algorithm that has a value between 0.00.. and 1 customizable to frequency of central-ness. Some high end math would be involved, I may need slight help here.. if not I'm going to have to do some research.

 

I have moved things like the method for random box point and random circle point to Divi\Math\ as RRectanglePoint and RCirclePoint so that's where the algorithm would be placed and affect the functions using them globally.

 

What remains is

 

the default 0.00.. - 1 global variable value and the actual MATH needed for the alg itself.

 

Hmm...

 

/goesintoendlessresearch

 

Some help would be helpful :P

 

Ok well good luck, not good with my math really :P otherwise I would help.

 

Addressing the mousespeed/other ideas is a topic for another thread. So if you want to keep talking about that feel free to make another discussion in feedback.

 

Ok will do.

 

However I will say that miss clicking is far from easy in case by case uses and most likely impossible in standardization meaning it will likely have to be something the end user designs and employs.

 

I did think maybe the script writer would be better of doing it for what its doing but i'm also on about loggin, lobby screens ect.. For example 'miss clicking the wrong world then re correcting its self to selecting the right world.

 

Link to comment
Share on other sites

I believe that would require way to much extra coding and complexity for little to nothing to show for it, if it even was known to make a difference in the first place.

 

The line has to be drawn somewhere otherwise we can spend 6 months writing one function

 

I see where your coming from.

 

Link to comment
Share on other sites

Is what I've come up with so far

 

[sCAR]function RRectanglePointEx(X1, Y1, X2, Y2, D: Integer): TPoint;

var

I: Integer;

C: TPoint;

B: TBox;

begin

C := Point(Round((X1 + X2) / 2), Round((Y1 + Y2) / 2));

B := Box(C.X - X1, C.Y - Y1, X2 - C.X, Y2 - C.Y);

for I := 0 to D do

B := Box(Random(B.X1), Random(B.Y1), Random(B.X2), Random(B.Y2));

Result := Point(C.X - B.X1 + B.X2, C.Y - B.Y1 + B.Y2);

end;[/sCAR]

 

1% pixels by area:

 

2pq588z.gif

 

The limitations are obvious but it may suffice.

 

Thoughts?

Link to comment
Share on other sites

@Wanted: Certainly looks like a start, but I wouldn't go past Density to avoid detection. It might be a good idea to re-evaluate this algorithm at some point, since as you said, there are obvious limitations. I'll look into creating an algorithm for this myself, see what I come up with.

Link to comment
Share on other sites

I went to a seminar about cloud computing today, was kind of boring so I've been doodling some math. I think I've come up witha good approach to the problem, but atm it only works for circles, so I'm going to do some transformations to apply it to rectangles as well. If it works properly I'll probably integrate the formula into SCAR. It uses normal distribution to generate a random value that is more likely to be centered than to be on the edge. You can adapt the variance (http://en.wikipedia.org/wiki/Normal_distribution) of the Gauss curve used for the algorithm to increase or decrease the changes of the returned point being centered. I'm still working out the code though, but it looks promising.

Link to comment
Share on other sites

So you could change the amount of pixel % by area and density ?

 

And have some sort of thing like

 

[scar]Function MouseBoxEx(BoxArea, pixel%, Density: Integer;Action: String; ): Boolean;[/scar]

 

So you can set how it click the box ?

 

Actually it has to be in increments of 1 starting with 0

 

the 1% simply explains that the image shows 1% of the total pixel area.

 

I will try and come out with images that show 100% of the pixels but it will take 100xs longer unless I stop being lazy write a script that actually uses canvases instead of MSpaint.

 

Edit:

 

Freddy

 

This alg has further applications beyond Rectangles.

 

It can also work for regular number ranges like WaitRR (WaitRandomRange) so the wait time is closer to average.

 

that can be applied to the radius part of RCirclePoint too.

 

Though we will also need what you just mentioned for RCirclePoint in OSI.

Link to comment
Share on other sites

This alg has further applications beyond Rectangles.

 

It can also work for regular number ranges like WaitRR (WaitRandomRange) so the wait time is closer to average.

 

that can be applied to the radius part of RCirclePoint too.

 

Though we will also need what you just mentioned for RCirclePoint in OSI.

 

Yes, I'm aware of this, all of the functions I'm building upon this algorithm are built upon one function that will also be exposed that uses normal distribution to return a random number with a higher chance to be closer to the "center value" based on a 0-1 scale. That way you can just multiply your maximum deviation from the center value by the number returned from the function and you have your random value. You will be able to set the variance and possibly the steps it uses to calculate this, basically a higher number of steps will make the number of possible results larger, so there's a bigger variation between the values you can actually receive as output, though I might just set it to like 1000 or 100000, which should be more than enough anyway. The algorithm would basically pick a random value from those, but there's a lot more values closer to 0 which drastically increases the chance of it actually returning a value close to 0. But again, this is all based on the variance you enter.

 

EDIT:

I've finished the function and here's an output of some values:

0,840991637846681
0,688077468129688
0,674601091515429
0,490535710627981
0,680500456793195
0,453118718901566
0,951598197564647
0,406254333240641
0,410633266597157
0,610468565268995
0,665017662293559
0,421733969964116
0,227956278048378
0,431311669999838
0,8298827838626
0,694268033700377
0,414058954637973
0,910656641555123
0,151920102114566
0,193156909320604
0,368547626562791
0,64464816820949
0,140075592987554
0,383427716210501
0,494644107760536
0,499864153771496
0,958478124737702
0,276770678789025
0,0706763343334793
0,177413955945375
0,774881644870742
0,391214304160509
0,425439875546366
0,452638109250282
0,99294338021203
0,844024460534174
0,730405427494716
0,382971276912188
0,929024301342944
0,735818883680404
0,1368625843762
0,303162390223717
0,501003089797291
0,295991245025585
0,480419692767152
0,287073653703519
0,832953440782063
0,183799573380504
0,711330545983555
0,832055469029231
0,658006582096772
0,465737769076322
0,328391706150575
0,391530753984179
0,713980708204794
0,177089053992839
0,2096240330727
0,346425014674107
0,829400475893874
0,526565801571235
0,715565221711683
0,407967277339678
0,532415074469789
0,897862706119547
0,44392728139912
0,371063240582051
0,829104010758959
0,666562733160104
0,914188234708424
0,857991022220405
0,412125294337091
0,416399416678639
0,445978062084703
0,440272024386801
0,142831701531778
0,872059216854884
0,51426253226467
0,744443459255981
0,462396412543496
0,509043182102111
0,466334400741518
0,862934988133654
0,398464516466556
0,563524677473273
0,557418587399863
0,368309758872536
0,16795242015153
0,362466093844023
0,543560025174128
0,545626133973767
0,866375764296266
0,291197593845703
0,72665359844212
0,383275585826275
0,130074474516046
0,499713259275102
0,462064407151955
0,194934400514627
0,739933759151601
0,317798629096997
0,468443499384959

 

I'm calculating with 100000 steps, so basically there's 100001 possible values in here, and the probability of a value being closer to 0 than 1 is based on the gauss function with a variance of 5 which I think is the best suitable variance for what we're trying to achieve. You can input the variance in the function though.

 

So the output I've posted contains 100 values. The function executed for those 100 in an average 1.40ms for me in SCAR, but when I move this to Delphi with inlining, it should work even faster. My point is though, that as you can see, the values are usually a lot closer to 0 than 1, so if you need to Random(100) with it being closer to 0 usually, you can multiply it with the result of this function, or use the Random function I intend to add that does that and rounding for you. An example of this:

 

80
89
64
72
55
44
30
14
35
58
68
21
51
75
23
47
84
92
59
66
13
25
99
65
31
38
27
71
44
45
45
65
40
32
52
84
92
32
55
60
99
59
48
59
98
57
13
86
73
61
52
28
23
30
64
10
24
21
92
27
80
49
33
56
10
42
48
36
47
90
68
45
43
90
78
33
22
35
61
60
72
45
31
59
55
13
9
76
32
36
42
81
82
63
34
37
51
9
67
37
55

 

EDIT2:

Here's a sorted example that will make it a bit more clear for you:

1: 3
2: 6
3: 7
4: 8
5: 13
6: 13
7: 15
8: 16
9: 16
10: 19
11: 19
12: 23
13: 23
14: 25
15: 26
16: 27
17: 29
18: 29
19: 29
20: 29
21: 30
22: 31
23: 32
24: 32
25: 34
26: 36
27: 37
28: 37
29: 38
30: 39
31: 39
32: 40
33: 40
34: 40
35: 41
36: 41
37: 41
38: 42
39: 42
40: 43
41: 43
42: 43
43: 43
44: 44
45: 44
46: 45
47: 45
48: 45
49: 46
50: 46
51: 47
52: 47
53: 47
54: 48
55: 49
56: 49
57: 50
58: 50
59: 51
60: 52
61: 53
62: 53
63: 54
64: 55
65: 55
66: 56
67: 57
68: 57
69: 58
70: 58
71: 58
72: 61
73: 61
74: 61
75: 61
76: 62
77: 62
78: 63
79: 63
80: 64
81: 64
82: 66
83: 67
84: 67
85: 67
86: 68
87: 68
88: 68
89: 73
90: 73
91: 73
92: 76
93: 81
94: 82
95: 82
96: 87
97: 88
98: 91
99: 94
100: 95

 

EDIT3:

Maybe a variance of 2 may be better for the mouse thing though, that outputs something like this:

1: 2
2: 4
3: 7
4: 7
5: 8
6: 9
7: 9
8: 9
9: 11
10: 11
11: 12
12: 13
13: 15
14: 15
15: 15
16: 15
17: 16
18: 17
19: 18
20: 18
21: 18
22: 19
23: 20
24: 20
25: 21
26: 22
27: 22
28: 23
29: 23
30: 24
31: 25
32: 25
33: 26
34: 26
35: 27
36: 27
37: 27
38: 28
39: 28
40: 29
41: 30
42: 31
43: 31
44: 31
45: 32
46: 32
47: 32
48: 33
49: 34
50: 34
51: 34
52: 36
53: 36
54: 36
55: 37
56: 37
57: 38
58: 38
59: 38
60: 38
61: 39
62: 39
63: 41
64: 41
65: 41
66: 42
67: 43
68: 43
69: 43
70: 43
71: 43
72: 43
73: 44
74: 44
75: 45
76: 45
77: 45
78: 47
79: 47
80: 48
81: 50
82: 50
83: 50
84: 51
85: 52
86: 52
87: 54
88: 55
89: 55
90: 56
91: 58
92: 62
93: 64
94: 65
95: 66
96: 69
97: 79
98: 82
99: 85
100: 96

Any lower and many values will be dropped though, I guess with a variance of 1 for Random(100), you'd only reach like around 70 at most except in very rare cases.

Link to comment
Share on other sites

My previous post was pretty long so I'm going to doublepost for once...

 

I had SCAR output some example pictures, not that this draws the random density in a circle, not a square. I've made the outer pixels more yellow and the inner ones more red. Basically what's happening here is that I'm having SCAR generate a random distance from the center point based on the normal distribution algorithm and then I'm having it generate a random angle. I convert the polar coordinate to a Cartesian one, and I draw it. Applying this to rectangles will require a bit more effort, but it can be done.

 

Variance 1:

RandomGauss-Var1.png

 

Variance 2:

RandomGauss-Var2.png

 

Variance 5:

RandomGauss-Var5.png

 

Note that the variance is specified by a floating point value, so you can also input like 3 or 3.1 or 4.9 or 0.2 or w/e you want basically, but these are some possible examples.

Link to comment
Share on other sites

Another post for rectangular areas (all on variance 2):

RandomGauss-Square-Var2.png

 

Precompression:

RandomGauss-Square-Var2-Compressed1.png

 

RandomGauss-Square-Var2-Compressed2.png

 

Postcompression:

RandomGauss-Square-Var2-Compressed3.png

 

RandomGauss-Square-Var2-Compressed4.png

 

EDIT: The algorithms when implemented in SCAR are lightning fast as well btw.

 

EDIT2: The algorithms are now in the 3.28 Alpha which is available in the repos.

 

Some scripts you could try:

[scar]var

b, i: Integer;

p: TPoint;

 

begin

b := BitmapFromString(501, 501, '');

for i := 0 to 9999 do

begin

p := RndCirclePointG(250, 250, 249, 2.5);

FastSetPixel(b, p.X, p.Y, 255);

end;

DebugBitmap(b);

end.[/scar]

 

[scar]var

i: Integer;

t: Cardinal;

 

const Count = 1000000;

 

begin

t := GetSystemTime;

for i := 0 to Count - 1 do

RndCirclePointG(250, 250, 249, 2);

t := GetSystemTime - t;

WriteLn('Avg: ' + FloatToStr(t / Count));

end.[/scar]

 

[scar]var

i: Integer;

t: Cardinal;

 

const Count = 1000000;

 

begin

t := GetSystemTime;

for i := 0 to Count - 1 do

RndBoxPointG(Box(0, 0, 500, 500), 2);

t := GetSystemTime - t;

WriteLn('Avg: ' + FloatToStr(t / Count));

end.[/scar]

 

My favorite:

[scar]var

b, i, j: Integer;

p: TPoint;

 

begin

for j := 0 to 1000 do

begin

b := BitmapFromString(501, 501, '');

for i := 0 to 9999 do

begin

p := RndCirclePointG(250, 250, 249, 2);

FastSetPixel(b, p.X, p.Y, 255);

end;

DebugBitmap(b);

FreeBitmap(b);

end;

end.[/scar]

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.

Guest
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.



×
  • Create New...