Skip to content

Add Humanise feature with 5-layer human fatigue simulation#7

Open
O-mkar wants to merge 1 commit intoWorldOfBasti:masterfrom
O-mkar:feature/humanise
Open

Add Humanise feature with 5-layer human fatigue simulation#7
O-mkar wants to merge 1 commit intoWorldOfBasti:masterfrom
O-mkar:feature/humanise

Conversation

@O-mkar
Copy link
Copy Markdown
Contributor

@O-mkar O-mkar commented Mar 1, 2026

Summary

Adds a "Humanise" toggle to MaClicker that replaces the fixed-interval auto-clicker with a variable-delay engine that simulates realistic human clicking patterns. When enabled, click timing is driven by a five-layer fatigue simulation designed to pass statistical bot-detection analysis.

What Changed

New File

  • HumanFatigueEngine.swift — Stateful engine that computes per-click delays through five combined layers (see Algorithm section below).

Modified Files

File Change
AutoClicker.swift Added humanise mode: DispatchWorkItem-based recursive scheduling (replaces fixed Timer), session state management, variable hold-duration clicks.
AppDelegate.swift Registered new UserDefaults: HumaniseEnabled, FatigueEnabled, NoiseEnabled, CollapseEnabled.
Main.storyboard (EN) Expanded view height to 320pt, added separator + "Humanise" label + enable checkbox + 3 sub-checkboxes (Fatigue arc, Noise drift, Collapses) with Auto Layout constraints.
Main.storyboard (DE) Same structural changes with German-width frames (409pt) and DE-suffix element IDs.
Localizable.strings (EN/DE) Added 5 localised strings for the new UI elements.
project.pbxproj Added HumanFatigueEngine.swift to Xcode project (file ref, build file, group, build phase).

Algorithm — Five Simulation Layers

1. Piecewise Fatigue Arc (stageMultiplier)

Models session-long endurance as four stages:

  • Warmup (0–30s): Ramps up to peak speed (multiplier 1.0 → 0.92)
  • Steady (30–180s): Near-peak with very slow degradation (0.92 → 1.10)
  • Onset (180–480s): Noticeable fatigue creep (1.10 → 1.60)
  • Exhaustion (480s+): Plateau at ~1.6× with high random variance

2. Random-Walk Drift (noiseMultiplier + stepWalk)

A momentum-based random walk (80% velocity carry-over) creates correlated tempo clusters — nearby clicks stay at a similar speed before the drift reverses. This produces the "chunky" organic rhythm visible in real human clicking charts, unlike IID random noise which creates uniform static.

Walk bounds scale with fatigue: ±12% when fresh → ±20% when exhausted.

A subtle 3-harmonic sine undertone adds long-term session uniqueness.

3. Burst Rhythm (applyBurstRhythm)

Humans click in micro-bursts of 2–6 fast clicks with brief natural pauses between them. This creates a bimodal timing distribution that is the primary statistical signature distinguishing human clicking from jitter-randomised autoclickers.

Implementation: probability-based gap system where gap chance starts at 15% and rises 7% per consecutive fast click (caps at 60%), creating variable-length bursts that don't form a detectable pattern.

  • Intra-burst clicks: 82–97% of base delay (slightly faster)
  • Inter-burst gaps: 125–180% of base delay (natural pause)

4. Collapse Events (collapseDelay)

Three probabilistic pause types:

  • Micro collapse: Brief attention lapse (~400ms), probability 0.1% → 3% over 10 min
  • Macro collapse: Fatigue wall (1.5–4.5s), only after 3 min, up to 1% chance
  • Rhythm break: 2% per-click chance of a 150–600ms rest

5. Log-Normal Jitter

Per-click noise uses exp(N(0, 0.06)) — a right-skewed distribution matching real human reaction-time studies. Unlike symmetric Gaussian jitter (which bot detectors flag), log-normal produces occasional longer delays with rare very short ones.

Timing Pipeline

CPS setting → baseMs (1000/CPS)
  → × stageMultiplier (fatigue arc)
  → × noiseMultiplier (random walk + sine drift)
  → applyBurstRhythm (bimodal burst/gap)
  → × log-normal jitter
  → + collapseMs (probabilistic pauses)
  → max(40ms, result)
  → subtract 33ms (hold time compensation)
  → schedule via DispatchQueue.asyncAfter
  → performHumaniseClick (mouseDown, ~25ms hold, mouseUp)

UI

The popover gains a new section below the existing controls:

  • Separator line
  • "Humanise" label + Enable checkbox — master toggle
  • Three sub-checkboxes (enabled only when Humanise is on):
    • Fatigue arc — toggle the piecewise stage multiplier
    • Noise drift — toggle the random walk + sine noise
    • Collapses — toggle micro/macro pause events

All controls use Cocoa Bindings via NSUserDefaultsController.

Testing

Tested against CPS analysis tools and bot-detection systems:

  • Effective CPS closely tracks the CPS setting (CPS=10 → avg ~6-8 effective CPS with natural variation)
  • Timing distribution is bimodal (burst pattern), not Gaussian
  • Autocorrelation structure matches human clicking (correlated clusters, not IID)
  • Fatigue curve degrades naturally over 8+ minute sessions

Introduce a "Humanise" toggle that makes the auto-clicker mimic realistic
human clicking patterns, defeating statistical bot-detection. When enabled,
clicks are scheduled with variable delays driven by a multi-layer engine
instead of a fixed timer.

Five simulation layers:
- Piecewise fatigue arc (warmup → steady → onset → exhaustion)
- Random-walk drift with 80% momentum for correlated tempo clusters
- Burst rhythm with probabilistic gaps creating bimodal timing distribution
- Collapse events (micro-lapses, macro fatigue walls, rhythm breaks)
- Log-normal jitter matching human reaction-time distributions

New files: HumanFatigueEngine.swift
Modified: AutoClicker.swift, AppDelegate.swift, both storyboards,
          both Localizable.strings, project.pbxproj

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant