一.鼠标轨迹模拟简介
传统的鼠标轨迹模拟依赖于简单的数学模型,如直线或曲线路径。然而,这种方法难以捕捉到人类操作的复杂性和多样性。AI大模型的出现,使得神诺科技 能够通过深度学习技术,学习并模拟更自然的鼠标移动行为。
二.鼠标轨迹算法实现
AI大模型通过学习大量的人类鼠标操作数据,能够识别和模拟出自然且具有个体差异的鼠标轨迹。以下是实现这一技术的关键步骤:
- 数据收集:收集不同玩家在各种游戏环境中的鼠标操作数据,包括移动速度、停顿、加速度等。
- 模型训练:利用深度学习算法,训练AI模型识别鼠标操作中的模式和规律。
- 轨迹生成:在给定起点和终点的情况下,AI模型能够生成符合人类操作习惯的鼠标轨迹。
三.鼠标轨迹API应用场景
游戏中通过分析玩家的鼠标轨迹,检测是否为脚本,例如:魔兽世界,无畏契约等等,大部分游戏都有数据行为检测!
四.API跨语言平台支持
鼠标轨迹api底层实现采用C/C++语言,利用其高性能和系统级访问能力,开发出高效的鼠标轨迹模拟算法。通过将算法封装为DLL(动态链接库),可以方便地在不同的编程环境中调用,实现跨语言的兼容性。
通过DLL封装,开发者可以在C++、Python、易语言、按键精灵等多种编程语言中使用鼠标轨迹模拟技术。这种封装方式提供了一种简便的接口,使得不同背景的开发者都能够轻松集成和使用这一技术。
五.鼠标轨迹 API 介绍
1.头文件
- /******************************************************************************************/
-
- @官方名称:神诺科技
-
- @官方网站:www.winsdk.cn
-
- @官方微信:cq41398
-
- @SDK功能描述:鼠标轨迹
-
- /******************************************************************************************/
-
- #ifndef _SN_SDK_H__
-
- #define _SN_SDK_H__
-
- #include <windows.h>
-
- //返回参数
-
- typedef struct SN_RESULT {
-
- int code; //错误码,如果为 0 表示成功,否则表示错误号
-
- char message[4096]; //错误信息,如果为 "OK" 表示成功,否则返回错误信息
-
- }SN_RESULT;
-
- //坐标参数
-
- typedef struct SN_POINT
-
- {
-
- int x; //屏幕坐标,左上角(0,0),右下角(1920,1080 - 以实际屏幕为准)
-
- int y; //屏幕坐标,左上角(0,0),右下角(1920,1080 - 以实际屏幕为准)
-
- }SN_POINT;
-
- //轨迹参数
-
- typedef struct SN_POINT_PARAMS
-
- {
-
- struct SN_POINT point;//屏幕坐标,左上角(0,0),右下角(1920,1080 - 以实际屏幕为准)
-
- int delayTime; //延时时间(单位:毫秒),仅供参考
-
- }SN_POINT_PARAMS;
-
- /*创建句柄
- *
- * 参数:
- * [in] szKey: 卡密(购买卡密:https://shop.4yuns.com/links/7C9F16B7)
- * [out] pResult: 返回错误信息,参数pResult.code(错误码)如果为 0 表示成功,否则表示错误号;
- *
- * 返回值:成功返回句柄,失败返回NULL
- *
- */
-
- HANDLE WINAPI apiSNCreateHandle(char* szKey, SN_RESULT* pResult);
-
- /*获取鼠标移动轨迹
- *
- * 参数:
- * [in] handle: 句柄(通过调用apiSNCreateHandle得到)
- * [in] startPoint: 开始坐标,左上角(0,0),右下角(1920,1080 - 以实际屏幕为准)
- * [in] endPoint: 结束坐标,左上角(0,0),右下角(1920,1080 - 以实际屏幕为准)
- * [out] points: 轨迹数组,如果数组中元素 point 出现(-1,-1),表示鼠标轨迹结束
- *
- * 返回值:返回参数SN_RESULT.code(错误码)如果为 0 表示成功,否则表示错误号;
- *
- */
-
- SN_RESULT WINAPI apiSNMouseMove(HANDLE handle, SN_POINT startPoint, SN_POINT endPoint, SN_POINT_PARAMS* points);
-
- /*获取版本号
- *
- * 参数:
- * [in] handle: 句柄(通过调用apiSNCreateHandle得到)
- * [out] szVersion: 版本号
- *
- * 返回值:返回参数SN_RESULT.code(错误码)如果为 0 表示成功,否则表示错误号;
- *
- */
-
- SN_RESULT WINAPI apiSNGetVersion(HANDLE handle, char* szVersion);
-
- /*获取错误信息
- *
- * 参数:
- * [in] handle: 句柄(通过调用apiSNCreateHandle得到)
- *
- * 返回值:返回参数SN_RESULT.code(错误码)如果为 0 表示成功,否则表示错误号;
- *
- */
-
- SN_RESULT WINAPI apiSNGetError(HANDLE handle);
-
- /*释放句柄(内存)
- *
- * 参数:
- * [in] handle: 句柄(通过调用apiSNCreateHandle得到)
- *
- * 返回值:返回参数SN_RESULT.code(错误码)如果为 0 表示成功,否则表示错误号;
- *
- */
-
- SN_RESULT WINAPI apiSNDestroyHandle(HANDLE handle);
-
- #endif // !_SN_SDK_H__
2.dll接口调用
-
- /******************************************************************************************/
-
- @官方名称:神诺科技
-
- @官方网站:www.winsdk.cn
-
- @官方微信:cq41398
-
- @SDK功能描述:鼠标轨迹
-
- /******************************************************************************************/
-
- //
-
- #include <iostream>
-
- #include "include/SNSDK.h"
-
- #pragma comment(lib,"./dll/x86/SNSDK.lib")
-
- int main()
-
- {
-
- SN_RESULT pResult = { 0 };
-
- char* pKey = (char*)"SNKJaURwbfuhcaQaCMJVhdByPZMVsZdqRUMjfWrxY1A5";
-
- //1.创建句柄
-
- HANDLE pHandle = apiSNCreateHandle(pKey,&pResult);
-
- if (!pHandle)
-
- {
-
- printf("error code:%d message:%s \n",pResult.code,pResult.message);
-
- return -__LINE__;
-
- }
-
- //2.获取轨迹
-
- SN_POINT startPoint = { 100,100 }; //开始坐标
-
- SN_POINT endPoint = { 800,800 }; //结束坐标
-
- SN_POINT_PARAMS track[4096] = { 0 };//轨迹
-
- pResult = apiSNMouseMove(pHandle, startPoint, endPoint, track);
-
- if (pResult.code != 0)
-
- {
-
- printf("error code:%d message:%s \n", pResult.code, pResult.message);
-
- return -__LINE__;
-
- }
-
- //3.鼠标根据轨迹移动,轨迹最后一个点(-1,-1)
-
- for (int i = 0; i < 4096; i++)
-
- {
-
- struct SN_POINT point = track[i].point;
-
- if (point.x <= 0 && point.y <= 0)//轨迹最后一个点(-1,-1)
-
- break;
-
- printf("x:%d y:%d delay_time:%d \n", point.x, point.y, track[i].delayTime);
-
- }
-
- //4.释放内存
-
- pResult = apiSNDestroyHandle(pHandle);
-
- return 1;
-
- }
-
- /*
- x:100 y:100 delay_time:0
- x:100 y:98 delay_time:10
- x:103 y:98 delay_time:15
- x:111 y:98 delay_time:16
- x:116 y:101 delay_time:15
- x:122 y:104 delay_time:2
- x:129 y:107 delay_time:13
- x:135 y:109 delay_time:2
- x:144 y:112 delay_time:14
- x:155 y:117 delay_time:2
- x:167 y:123 delay_time:14
- x:180 y:128 delay_time:2
- x:193 y:134 delay_time:13
- x:209 y:138 delay_time:2
- x:225 y:144 delay_time:13
- x:238 y:149 delay_time:5
- x:254 y:157 delay_time:10
- x:269 y:162 delay_time:5
- x:282 y:168 delay_time:11
- x:298 y:175 delay_time:5
- x:311 y:180 delay_time:10
- x:326 y:185 delay_time:6
- x:341 y:193 delay_time:9
- x:369 y:211 delay_time:15
- x:396 y:231 delay_time:16
- x:419 y:251 delay_time:16
- x:442 y:270 delay_time:16
- x:461 y:285 delay_time:17
- x:481 y:300 delay_time:15
- x:491 y:311 delay_time:15
- x:502 y:319 delay_time:2
- x:513 y:329 delay_time:14
- x:523 y:343 delay_time:2
- x:535 y:355 delay_time:14
- x:546 y:369 delay_time:0
- x:558 y:383 delay_time:15
- x:570 y:397 delay_time:2
- x:582 y:411 delay_time:13
- x:596 y:427 delay_time:2
- x:608 y:443 delay_time:14
- x:620 y:459 delay_time:5
- x:633 y:476 delay_time:10
- x:645 y:490 delay_time:5
- x:656 y:503 delay_time:11
- x:666 y:515 delay_time:5
- x:675 y:527 delay_time:11
- x:684 y:538 delay_time:5
- x:694 y:551 delay_time:11
- x:702 y:565 delay_time:5
- x:710 y:577 delay_time:11
- x:716 y:588 delay_time:5
- x:723 y:598 delay_time:11
- x:728 y:606 delay_time:5
- x:733 y:615 delay_time:11
- x:738 y:622 delay_time:5
- x:743 y:631 delay_time:11
- x:747 y:637 delay_time:5
- x:750 y:644 delay_time:11
- x:753 y:652 delay_time:5
- x:756 y:659 delay_time:10
- x:759 y:666 delay_time:5
- x:761 y:673 delay_time:11
- x:764 y:680 delay_time:5
- x:766 y:687 delay_time:11
- x:768 y:694 delay_time:5
- x:769 y:701 delay_time:10
- x:771 y:708 delay_time:5
- x:772 y:714 delay_time:11
- x:773 y:722 delay_time:5
- x:774 y:729 delay_time:10
- x:777 y:743 delay_time:16
- x:778 y:755 delay_time:15
- x:778 y:764 delay_time:16
- x:780 y:775 delay_time:16
- x:781 y:784 delay_time:16
- x:781 y:785 delay_time:15
- x:781 y:789 delay_time:2
- x:781 y:790 delay_time:13
- x:781 y:792 delay_time:2
- x:782 y:796 delay_time:14
- x:782 y:796 delay_time:2
- x:782 y:797 delay_time:14
- x:782 y:798 delay_time:15
- x:782 y:800 delay_time:311
- x:784 y:800 delay_time:16
- x:784 y:800 delay_time:5
- x:785 y:800 delay_time:10
- x:786 y:800 delay_time:5
- x:786 y:800 delay_time:11
- x:788 y:800 delay_time:6
- x:789 y:800 delay_time:9
- x:790 y:800 delay_time:5
- x:791 y:800 delay_time:10
- x:793 y:800 delay_time:16
- x:795 y:800 delay_time:16
- x:796 y:800 delay_time:15
- x:797 y:800 delay_time:15
- x:797 y:800 delay_time:2
- x:798 y:800 delay_time:15
- x:798 y:800 delay_time:30
- x:799 y:800 delay_time:15
- x:799 y:800 delay_time:15
- */