play: throttle quiz_carry preview bot pathfinding; slower path steps in editor embed
Made-with: Cursor
This commit is contained in:
@@ -1083,6 +1083,7 @@
|
||||
balloonBossScore: 0,
|
||||
balloonBossBalloons: 5,
|
||||
balloonBossEliminated: false,
|
||||
botQuizCarryPathfindAfter: performance.now() + previewBotSeq * 75 + Math.floor(Math.random() * 160),
|
||||
});
|
||||
botIds.push(id);
|
||||
}
|
||||
@@ -1104,6 +1105,14 @@
|
||||
o.ty = s.y;
|
||||
});
|
||||
}
|
||||
if (mapData.gameType === 'quiz_carry') {
|
||||
const t0 = performance.now();
|
||||
[...others.keys()].filter(isPreviewBotId).forEach((bid, idx) => {
|
||||
const o = others.get(bid);
|
||||
if (!o) return;
|
||||
o.botQuizCarryPathfindAfter = t0 + idx * 90 + Math.floor(Math.random() * 140);
|
||||
});
|
||||
}
|
||||
if (mapData.gameType === 'gauntlet') {
|
||||
applyGauntletPreviewSpawnLayout(false);
|
||||
emitGauntletPreviewRowsToServer();
|
||||
@@ -2039,6 +2048,8 @@
|
||||
function stepQuizCarryPreviewBots() {
|
||||
if (!previewFillBots || !isQuizCarry() || !mapData || !quizCarryCurrent) return;
|
||||
const w = mapData.width || 20, h = mapData.height || 15;
|
||||
const nowPf = performance.now();
|
||||
const pathfindMinGap = editorEmbedReturn ? 280 : 140;
|
||||
others.forEach((o, id) => {
|
||||
if (!isPreviewBotId(id)) return;
|
||||
if (!o.botPath || o.botPath.length === 0) {
|
||||
@@ -2050,6 +2061,9 @@
|
||||
: Math.floor(Math.random() * Math.max(2, (quizCarryCurrent.choices || []).length));
|
||||
const wantIdx = pickQuizCarryTargetOptionIndexAvoidingTaken(rawWant);
|
||||
if (!o.botPath || !o.botPath.length) {
|
||||
if (typeof o.botQuizCarryPathfindAfter !== 'number') o.botQuizCarryPathfindAfter = 0;
|
||||
if (nowPf < o.botQuizCarryPathfindAfter) return;
|
||||
const jitter = (String(id).length * 31 + ((o.x | 0) ^ (o.y | 0)) * 7) % 160;
|
||||
if (o.quizCarryHeld == null && wantIdx != null) {
|
||||
const dest = pickRandomTileForQuizCarryOption(mapData, wantIdx, o);
|
||||
if (dest) {
|
||||
@@ -2063,6 +2077,7 @@
|
||||
if (path && path.length > 1) o.botPath = path.slice(1);
|
||||
}
|
||||
}
|
||||
o.botQuizCarryPathfindAfter = nowPf + pathfindMinGap + jitter;
|
||||
} else {
|
||||
stepPreviewBotAlongPath(o, w, h);
|
||||
}
|
||||
@@ -5805,7 +5820,8 @@
|
||||
return;
|
||||
}
|
||||
const len = dist || 1;
|
||||
const step = Math.min(MOVE_SPEED * 1.28, len);
|
||||
const pathStepMul = (previewFillBots && editorEmbedReturn) ? 0.56 : 1;
|
||||
const step = Math.min(MOVE_SPEED * 1.28 * pathStepMul, len);
|
||||
const nx = o.x + (dx / len) * step;
|
||||
const ny = o.y + (dy / len) * step;
|
||||
if (Math.abs(dy) > Math.abs(dx)) o.direction = dy > 0 ? 'down' : 'up';
|
||||
|
||||
@@ -669,7 +669,7 @@
|
||||
</div>
|
||||
<script src="/Game/socket.io/socket.io.js"></script>
|
||||
<script src="js/version.js?v=0.0166"></script>
|
||||
<script src="js/play.js?v=0.082"></script>
|
||||
<script src="js/play.js?v=0.083"></script>
|
||||
<div class="version-tag">v —</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user