Beginner "Pseudo-random" Question Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Pharma
Posts: 11
Joined: 13 Dec 2016, 18:14

Beginner "Pseudo-random" Question

21 Sep 2017, 14:49

Hey all,

Sorry if this has been done many times. Wasn't sure what to search.

Anyways, I'm trying to make my "randomly" generated points a little more human-like.
The two lines between the ###'s below are the parts I'd like to fix.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Problem is that I don't know how to even begin to script such a thing.
This Box Muller Transform looks pretty damn good.
But maybe this is too much to ask.

I think anything that would kind of make it humanlike would suffice.

Image

Thanks!
User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

21 Sep 2017, 15:01

I'm far from a mathmatician and I'm not exactly sure what the difference between human-like and computer would be, but you could try smoothing the plot points.
e.g make each new plot the average between previous and current point
pseudo code example:

Code: [Select all] [Download] GeSHi © Codebox Plus

current_point := generate_new_point()
actual_point := average(current_point, last_point)
plot(actual_point)
static last_point := actual_point


:think: not sure if thats what your looking for but in theory it might look more like the box-muller picture than the uniform picture.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
Helgef
Posts: 2469
Joined: 17 Jul 2016, 01:02
Contact:

Re: Beginner "Pseudo-random" Question  Topic is solved

21 Sep 2017, 17:50

It is a very simple transformation. Try it in fullscreen paint and press space to start it.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Edit:
normal.png
normal.png (8.17 KiB) Viewed 363 times
User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

21 Sep 2017, 21:30

interesting, whats it for? if i may ask
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



User avatar
Brazolek123
Posts: 153
Joined: 06 Jun 2016, 16:02

Re: Beginner "Pseudo-random" Question

22 Sep 2017, 02:26

https://autohotkey.com/board/topic/6461 ... om-number/

Normal distribution in both axis might result in such effect.
Helgef
Posts: 2469
Joined: 17 Jul 2016, 01:02
Contact:

Re: Beginner "Pseudo-random" Question

22 Sep 2017, 02:37

Brazolek123, the Box-Muller transfromation, yields a normal distrubution.
User avatar
Gio
Posts: 218
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Beginner "Pseudo-random" Question

22 Sep 2017, 15:44

Anyways, I'm trying to make my "randomly" generated points a little more human-like.


If this is to fool an anti-bot software like those of MMO games, you better know that it is actually not hard to figure out someone is using a "weighted" form of randomness such as box muller transformation in their clicks. Any randomness algorithm you can come up will probably differ greatly from an actual human sample in no time. Your best shot to look "human like" is to collect actual human behaviour, shuffle it and than replicate. One such example is to collect the coordinates and timing of thousands of actual human clicks (record them for 1-2 hours), shuffle the sequences of coordinates and times and run the new set. This will include a distinct human behaviour pattern that is very hard for any anti-bot to find out.
"What is a suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Pharma
Posts: 11
Joined: 13 Dec 2016, 18:14

Re: Beginner "Pseudo-random" Question

24 Sep 2017, 13:34

Hello all,

Sorry for the delayed response.
Took me awhile to test and understand the code.

What I ended up doing was mix the AHK random and Helgef's Box-Miller Transform.
Below is part of my script.
Seems to be working!

Thank you all for your help!

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

25 Sep 2017, 21:11

I know this questions been solved and all, but I decided I'd take a stab at this sort of algorithm myself, despite my extreme lack of math skills...
so I started out generating this (averaging with basevalue)
#1Image
then I got it to here (+noise)
#2Image
now (without noise) (averaging with prior value)
#3Image and with noise (averaging with prior value) #4Image
more like The UnMathematician's False-Box Muller, lol
Like I said bare in mind I have very poor math skills.
*EDIT*
After an idea hit me to try utilizing 3 uniform-boxes with progressively less chance of hitting outer boxes
TripleBoxRandom
#5Image
then I added smoothing (averaging with prior value)
#6Image and a version with tweaked uniform box generation #7Image
*EDIT* 2
Heres an example from the code used in picture #4 with a bug-fix (which was causing a negative value bias)
#8Image

I imagine if one did averaging with more than 2 values, periodically inserting the center value in there you could get a nice looking center biased plot.
here is one where I average 3 values [prior, new and center]
#9Image or 50% chance to average with center #10Image
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



Helgef
Posts: 2469
Joined: 17 Jul 2016, 01:02
Contact:

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 05:36

KuroiLight, nice job :thumbup: But where is the code :?: :geek:
User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 09:39

I cleaned it up a bit but It's not pretty and could probably be optimized.
#3 & #8:
ImageImage

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



#5 & #7 & #10
ImageImageImage

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



FanaticGuru
Posts: 794
Joined: 30 Sep 2013, 22:25

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 14:56

Gio wrote:
Anyways, I'm trying to make my "randomly" generated points a little more human-like.


If this is to fool an anti-bot software like those of MMO games, you better know that it is actually not hard to figure out someone is using a "weighted" form of randomness such as box muller transformation in their clicks. Any randomness algorithm you can come up will probably differ greatly from an actual human sample in no time. Your best shot to look "human like" is to collect actual human behaviour, shuffle it and than replicate. One such example is to collect the coordinates and timing of thousands of actual human clicks (record them for 1-2 hours), shuffle the sequences of coordinates and times and run the new set. This will include a distinct human behaviour pattern that is very hard for any anti-bot to find out.
I agree with Gio. None of the examples in this thread look to me like what a human click pattern would look like. The problem is that they all look too random.

From what I have seen, human click patterns tend to have a skewed axis aligned toward the center of the screen based on the position of the button being clicked. ie. A button in the far bottom right has a different click pattern than a button slightly off center to the left. Kind of a vaguely tear drop type shape. The shape of the button also plays a role. The script has to miss clicking on the button sometimes. The list goes on and on. The game has the advantage that is can collect the data from millions of human clicks and can look for any pattern that is out of the norm.

If the game was to actually track mouse movement, speed, and timing then it really becomes hard to look human with math. Bézier Curves and the likes are better than a straight line but they are far from human. On the plus side the game will probably be analysis the pattern with math so you just need a random algorithm good enough to fool their detection algorithm.

The sampling of actual human movements would probably be pretty good but intensive to develop and implement.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 15:24

FanaticGuru wrote:From what I have seen, human click patterns tend to have a skewed axis aligned toward the center of the screen based on the position of the button being clicked. ie. A button in the far bottom right has a different click pattern than a button slightly off center to the left. Kind of a vaguely tear drop type shape.

FG


Maybe like this?
Image
The first one is with center smoothing offset right and slightly down, second one is just offset right.
*EDIT*
Seems a bit harder to get that teardrop shape without using actual maths, will experiment a bit and try for a sort of fireball shape if I can.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]



FanaticGuru
Posts: 794
Joined: 30 Sep 2013, 22:25

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 17:19

KuroiLight wrote:Maybe like this?
Image
The first one is with center smoothing offset right and slightly down, second one is just offset right.

These are better. For a rectangular button to the middle left of center of screen.

If the button was near the bottom left of the screen it would kind of have a counter clockwise twist to the axis. But it is not really a simple twist it is a skew in two directions.

Even for a button straight left of center, your pattern distribution is too symmetrically top and bottom. From what I read awhile back when I played with similar coding, humans tend to click a little more randomly high so that the top is more random and inaccurate than the bottom.

Your top one is more of this idea of skewing in two directions but at a glance it seems too blocky but on a rectangular button that might actual be it but I like the distribution from the center better on the second but too symmetrical top and bottom. You don't want the pattern to be too symmetrical on any axis as that is math that a detection algorithm could look for. From what I understand with real human movement it is a skew on multiple axis based on multiple factors. Arm movement will cause it to be skewed one way in the direction that arms move naturally, hand movement to be skewed another as wrist tend to move better side to side than up and down, fingers, eyes, psychology, etc. tending to make errors in multiple discernable axis.

Below is a related thread.
https://autohotkey.com/board/topic/99251-weighted-random-functions-asymmetric-parabola-and-formula/
It has some equations and math that I played with in the past. It was during this time that I researched human mouse moving and click to discover that it is pretty hard to do really good because humans don't really move and click at random.

Now don't get me wrong, you can definitely do it well enough to fool most games as they don't want to spend the processing power and bandwidth not to mention the coding expertise to implement really good. It is just hard to fool a focused analysis. Game companies don't really care about cheating, only disruption. If the cheating is not affecting their servers or other players too much, they don't care too much. There are other statistics that are easier to collect to flag suspicious play.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
User avatar
KuroiLight
Posts: 254
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: Beginner "Pseudo-random" Question

26 Sep 2017, 19:32

FanaticGuru wrote:Now don't get me wrong, you can definitely do it well enough to fool most games as they don't want to spend the processing power and bandwidth not to mention the coding expertise to implement really good. It is just hard to fool a focused analysis. Game companies don't really care about cheating, only disruption. If the cheating is not affecting their servers or other players too much, they don't care too much. There are other statistics that are easier to collect to flag suspicious play.

FG


I would think most anti-cheats, if they even implement any sort of click analysis would focus more on click times than locations, unless ofcoarse your bot or what ever was clicking the same spots every time then it would be pretty obvious.
Anyways I was just doing to see if I could with few math skills, Ill more than likely use the random generation for 1-dimensional sleeps/timers/clicktimes to make things like auto-clickers look more organic than a simple random.
heres a visualization of what I mean, (mind the poor gif speed)
Image
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]




Return to “Ask For Help”

Who is online

Users browsing this forum: anime, gregster, rakesha002 and 62 guests