This project provides tools for creating realistic mouse movement patterns for use in DreamBot scripts.
It includes data collection, processing, and example implementation for natural mouse movements.
recorder.py
Records mouse movements for 8 different directions and various distance thresholds using a visual interface with green (start) and red (end) dots.
-
parser.py
Processes raw mouse data into a format usable by DreamBot scripts, organizing movement data by threshold and direction. -
remove_outliers.py
Cleans the dataset by removing outliers and erroneous mouse recordings. -
move.py
Utility for testing the recorded mouse movements visually.
-
SmartMouseMultiDir.java
A custom mouse movement algorithm implementation for DreamBot that uses the recorded data to create human-like mouse movements. -
RandomMouseMover.java
Example script that demonstrates the use of the custom mouse movement algorithm. -
SimulateAFK.java
Utility class for simulating AFK behavior by moving the mouse off-screen and back with natural movements. -
OffScreenPointGenerator.java
Generates off-screen points for the AFK simulator.
See the algorithm in action here: Mouse Movement Demo
To use only the SmartMouseMultiDir algorithm in your own scripts:
Copy the SmartMouseMultiDir.java and mousedata.json files to your project.
Add the following line to your script's onStart() method:
@Override
public void onStart() {
Mouse.setMouseAlgorithm(new SmartMouseMultiDir());
// Your other initialization code
}The dreambot_example folder contains a small pre-made dataset that's ready to use with the algorithm immediately.
If you prefer to create your own custom mouse movement dataset, follow these steps:
Run the cover recorder to collect movement data: recorder.py
Move your mouse to the red dot and click it (it turns green). Move your mouse to the blue dot and click it (a new pair spawns after).
- Parse the data into the correct format:
parser.pygeneratesmousedata_parsed.json - Clean the data by removing outliers:
remove_outliers.pygeneratesmousedata_parsed_cleaned.json - Check if you have at least one path per distance and angle category using
counter.py
- Rename the generated
mousedata_parsed_cleaned.jsontomousedata.jsonand add it to your DreamBot script resources. - Implement the
SmartMouseMultiDirclass as your mouse movement algorithm. - Use the example
RandomMouseMoverscript as a template for your own scripts.
The SmartMouseMultiDir class implements DreamBot's MouseAlgorithm interface to create realistic mouse movements based on recorded human behavior. Here's how it works:
- Mouse movements are categorized by distance thresholds:
[12, 18, 26, 39, 58, 87, 130, 190, 260, 360, 500]pixels - For any movement, the algorithm selects the appropriate threshold bucket for the current distance
- Mouse paths are organized into 8 compass directions
(N, NE, E, SE, S, SW, W, NW) - When moving to a target, the algorithm computes the angle and selects the appropriate directional category
- For a given distance and direction, the algorithm:
- Retrieves a random pre-recorded path from
mousedata.json - Extracts the offset patterns (dx, dy increments) for each point in the path
- Adjusts these offsets to match the exact start and end positions
- Generates a complete path with intermediate points
- Retrieves a random pre-recorded path from
-
Each path step uses variable speeds based on distance:
- Short distances: 0.005-0.007 seconds per step
- Medium distances: 0.007-0.010 seconds per step
- Long distances: 0.010-0.013 seconds per step
-
The algorithm applies easing functions to simulate human acceleration/deceleration:
ease_out_cubic: Quick start with gradual slowdownease_in_out_cubic: Gradual start, mid-acceleration, gradual finishease_linear: Constant speed movement
- Each point-to-point movement is further subdivided into micro-steps
- Adds subtle human-like variance to speeds (±5%)
- Simulates the natural jitter and imprecision in human movements
The SimulateAFK class allows scripts to move the mouse off-screen to simulate AFK behavior.
// Configure the SimulateAFK settings
SimulateAFK.setFocusManipulation(true);
SimulateAFK.setFocusChances(70, 30);
// Move mouse off-screen occasionally
if (shouldSimulateAFK()) {
SimulateAFK.moveMouseOut();
}The mousedata.json file uses a hierarchical structure:
{
"12": {
"N": [ [ [dx offsets], [dy offsets] ], ... ],
"NE": [ ... ],
"E": [ ... ],
...
},
"18": { ... },
...
}- Top level: Distance thresholds
- Second level: 8 directions
- Third level: Lists of recorded path offset pairs
This project is for educational purposes only. Using bots in online games may be against the terms of service.

