From 62519deda5faec6f90c8d26842bccf5fe7ee29b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=AA=E7=B1=BD=E9=98=B3=E5=A4=96=E5=A9=86?= <2915414902@qq.com> Date: Mon, 4 Nov 2024 21:53:54 +0800 Subject: [PATCH] PathingBenchmark --- .../assets/Benchmark/传送速度测试.json | 36 +++++++ .../assets/Benchmark/寻路速度测试.json | 76 +++++++++++++ .../assets/Benchmark/抗打断测试.json | 100 ++++++++++++++++++ .../assets/Benchmark/攀爬速度测试.json | 36 +++++++ .../assets/Benchmark/游泳速度测试.json | 36 +++++++ .../assets/Benchmark/飞行速度测试.json | 36 +++++++ repo/js/PathingBenchmark/main.js | 56 ++++++++++ repo/js/PathingBenchmark/manifest.json | 12 +++ 8 files changed, 388 insertions(+) create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/传送速度测试.json create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/寻路速度测试.json create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/抗打断测试.json create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/攀爬速度测试.json create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/游泳速度测试.json create mode 100644 repo/js/PathingBenchmark/assets/Benchmark/飞行速度测试.json create mode 100644 repo/js/PathingBenchmark/main.js create mode 100644 repo/js/PathingBenchmark/manifest.json diff --git a/repo/js/PathingBenchmark/assets/Benchmark/传送速度测试.json b/repo/js/PathingBenchmark/assets/Benchmark/传送速度测试.json new file mode 100644 index 00000000..315bf3b3 --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/传送速度测试.json @@ -0,0 +1,36 @@ +{ + "info": { + "name": "传送速度测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "walk", + "type": "teleport", + "x": -1629.36328125, + "y": 2834.419921875 + }, + { + "id": 9, + "x": -321.7978515625, + "y": 1473.583984375, + "type": "teleport", + "move_mode": "walk", + "action": "" + }, + { + "id": 3, + "x": -1999.125, + "y": 1434.90380859375, + "type": "teleport", + "move_mode": "walk", + "action": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/assets/Benchmark/寻路速度测试.json b/repo/js/PathingBenchmark/assets/Benchmark/寻路速度测试.json new file mode 100644 index 00000000..2cb7f44e --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/寻路速度测试.json @@ -0,0 +1,76 @@ +{ + "info": { + "name": "寻路速度测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 1, + "x": -1999.0830078125, + "y": 1434.9326171875, + "action": "", + "move_mode": "walk", + "type": "teleport" + }, + { + "id": 2, + "x": -2070.6396484375, + "y": 1413.53515625, + "action": "", + "move_mode": "walk", + "type": "path" + }, + { + "id": 3, + "x": -2143.72265625, + "y": 1485.27880859375, + "action": "", + "move_mode": "walk", + "type": "target" + }, + { + "id": 4, + "x": -2140.0869140625, + "y": 1547.9375, + "action": "", + "move_mode": "run", + "type": "path" + }, + { + "id": 5, + "x": -2065.7763671875, + "y": 1586.3212890625, + "action": "", + "move_mode": "walk", + "type": "target" + }, + { + "id": 6, + "x": -2021.23046875, + "y": 1536.51171875, + "action": "", + "move_mode": "walk", + "type": "path" + }, + { + "id": 7, + "x": -1995.1162109375, + "y": 1483.43212890625, + "action": "", + "move_mode": "walk", + "type": "path" + }, + { + "id": 8, + "x": -2002.0029296875, + "y": 1442.0478515625, + "action": "", + "move_mode": "run", + "type": "target" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/assets/Benchmark/抗打断测试.json b/repo/js/PathingBenchmark/assets/Benchmark/抗打断测试.json new file mode 100644 index 00000000..564b67eb --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/抗打断测试.json @@ -0,0 +1,100 @@ +{ + "info": { + "name": "抗打断测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 4, + "x": -1273.7822265625, + "y": 2721.7109375, + "type": "teleport", + "move_mode": "walk", + "action": "" + }, + { + "id": 5, + "x": -1275.470703125, + "y": 2754.51025390625, + "type": "path", + "move_mode": "run", + "action": "" + }, + { + "id": 6, + "x": -1289.6181640625, + "y": 2780.678955078125, + "type": "target", + "move_mode": "walk", + "action": "" + }, + { + "id": 7, + "x": -1276.720703125, + "y": 2784.83203125, + "type": "path", + "move_mode": "run", + "action": "" + }, + { + "id": 8, + "x": -1225.1103515625, + "y": 2792.60009765625, + "type": "path", + "move_mode": "walk", + "action": "" + }, + { + "id": 9, + "x": -1219.517578125, + "y": 2788.16259765625, + "type": "path", + "move_mode": "run", + "action": "" + }, + { + "id": 10, + "x": -1208.072265625, + "y": 2776.15966796875, + "type": "target", + "move_mode": "walk", + "action": "" + }, + { + "id": 11, + "x": -1187.6162109375, + "y": 2752.934326171875, + "type": "path", + "move_mode": "run", + "action": "" + }, + { + "id": 12, + "x": -1173.4970703125, + "y": 2741.677978515625, + "type": "path", + "move_mode": "walk", + "action": "" + }, + { + "id": 13, + "x": -1180.5546875, + "y": 2738.550537109375, + "type": "path", + "move_mode": "run", + "action": "" + }, + { + "id": 14, + "x": -1172.67578125, + "y": 2714.897705078125, + "type": "target", + "move_mode": "walk", + "action": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/assets/Benchmark/攀爬速度测试.json b/repo/js/PathingBenchmark/assets/Benchmark/攀爬速度测试.json new file mode 100644 index 00000000..719d5d40 --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/攀爬速度测试.json @@ -0,0 +1,36 @@ +{ + "info": { + "name": "攀爬速度测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "walk", + "type": "teleport", + "x": -1629.373046875, + "y": 2834.40283203125 + }, + { + "id": 2, + "x": -1611.1640625, + "y": 2823.08056640625, + "type": "path", + "move_mode": "climb", + "action": "" + }, + { + "id": 3, + "x": -1602.9296875, + "y": 2819.64990234375, + "type": "path", + "move_mode": "climb", + "action": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/assets/Benchmark/游泳速度测试.json b/repo/js/PathingBenchmark/assets/Benchmark/游泳速度测试.json new file mode 100644 index 00000000..9106dac9 --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/游泳速度测试.json @@ -0,0 +1,36 @@ +{ + "info": { + "name": "游泳速度测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "walk", + "type": "teleport", + "x": -1120.90234375, + "y": 2190.519287109375 + }, + { + "id": 2, + "x": -1078.2978515625, + "y": 2216.023681640625, + "type": "path", + "move_mode": "swim", + "action": "" + }, + { + "id": 3, + "x": -979.3251953125, + "y": 2283.71728515625, + "type": "path", + "move_mode": "swim", + "action": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/assets/Benchmark/飞行速度测试.json b/repo/js/PathingBenchmark/assets/Benchmark/飞行速度测试.json new file mode 100644 index 00000000..10dc8b4f --- /dev/null +++ b/repo/js/PathingBenchmark/assets/Benchmark/飞行速度测试.json @@ -0,0 +1,36 @@ +{ + "info": { + "name": "飞行速度测试", + "type": "collect", + "author": "HZYgrandma", + "version": "1.0", + "description": "", + "bgiVersion": "0.35.0" + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "walk", + "type": "teleport", + "x": -1536.8916015625, + "y": 1978.646484375 + }, + { + "id": 2, + "x": -1479.0283203125, + "y": 1869.71875, + "type": "path", + "move_mode": "fly", + "action": "" + }, + { + "id": 3, + "x": -1476.4248046875, + "y": 1864.8203125, + "type": "path", + "move_mode": "fly", + "action": "stop_flying" + } + ] +} \ No newline at end of file diff --git a/repo/js/PathingBenchmark/main.js b/repo/js/PathingBenchmark/main.js new file mode 100644 index 00000000..fb5f94bc --- /dev/null +++ b/repo/js/PathingBenchmark/main.js @@ -0,0 +1,56 @@ +(async function () { + dispatcher.addTimer(new RealtimeTimer("AutoPick")); + + async function AutoPath(locationName) { + let filePath = `assets/Benchmark/${locationName}.json`; + await pathingScript.runFile(filePath); + await sleep(1000); + } + + function logScore(startTime, testName) { + const endTime = Date.now(); + const timeTaken = (endTime - startTime) / 1000; + const presetTimes = { + '传送速度测试': 4500, + '飞行速度测试': 3000, + '游泳速度测试': 6000, + '攀爬速度测试': 7000, + '寻路速度测试': 12000, + '抗打断测试': 9000 + }; + const score = presetTimes[testName] / timeTaken; + log.info(`完成 ${testName} ,得分 ${score.toFixed(2)}`); + return score; + } + + async function runTest(testName, weight) { + const startTime = Date.now(); + log.info('进行 {name}', testName); + await AutoPath(testName); + const score = await logScore(startTime, testName); + scores.push({ name: testName, score, weight }); + } + + const weights = { + '传送速度测试': 0.1, + '飞行速度测试': 0.1, + '游泳速度测试': 0.1, + '攀爬速度测试': 0.1, + '抗打断测试': 0.1, + '寻路速度测试': 0.5 + }; + + const scores = []; + + await runTest('传送速度测试', weights['传送速度测试']); + await runTest('飞行速度测试', weights['飞行速度测试']); + await runTest('游泳速度测试', weights['游泳速度测试']); + await runTest('攀爬速度测试', weights['攀爬速度测试']); + await runTest('寻路速度测试', weights['寻路速度测试']); + await runTest('抗打断测试', weights['抗打断测试']); + + // 计算加权总得分 + const totalWeightedScore = scores.reduce((sum, item) => sum + item.score * item.weight, 0); + log.info(`加权总得分:${totalWeightedScore.toFixed(2)}`); + keyPress("m"); +})(); \ No newline at end of file diff --git a/repo/js/PathingBenchmark/manifest.json b/repo/js/PathingBenchmark/manifest.json new file mode 100644 index 00000000..b35e6e90 --- /dev/null +++ b/repo/js/PathingBenchmark/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": 1, + "name": "路径追踪配队跑分", + "version": "1.0", + "description": "对配队的路径追踪性能进行量化呈现", + "authors": [ + { + "name": "HZYgrandma", + } + ], + "main": "main.js" +} \ No newline at end of file