Skip to content

Commit 590aac2

Browse files
globs: inter-round pause (default 4.5s) so client animations breathe — the instant next-phase stomped the resolution replay; configurable, tests run at 0
1 parent 2c2f6f5 commit 590aac2

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

compose.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('composition: every plugin on one server', () => {
6262
plugins: [
6363
{ module: at('relay/plugin.js'), prefix: '/relay' },
6464
{ module: at('webrtc/plugin.js'), prefix: '/webrtc' },
65-
{ module: at('globs/plugin.js'), prefix: '/globs', config: { aimTimeMs: 300 } },
65+
{ module: at('globs/plugin.js'), prefix: '/globs', config: { aimTimeMs: 300, interRoundMs: 0 } },
6666
{ module: at('terminal/plugin.js'), prefix: '/terminal', config: { token: 'compose-secret' } },
6767
{ module: at('tunnel/plugin.js'), prefix: '/tunnel' },
6868
{

globs/plugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ const START_RATING = 1200;
5555
const K_HUMAN = 32, K_BOT = 16;
5656
const QUEUE_BOT_FALLBACK_MS = 10_000;
5757
const RESOLVE_GRACE_MS = 2_000;
58+
const INTER_ROUND_MS = 4_500; // let the clients' resolution animation breathe
5859

5960
export async function activate(api) {
6061
const prefix = api.prefix || '/globs';
6162
const aimMs = api.config.aimTimeMs ?? AIM_TIME * 1000;
63+
const interRoundMs = api.config.interRoundMs ?? INTER_ROUND_MS;
6264
const dir = api.storage.pluginDir();
6365
const eloFile = path.join(dir, 'elo.json');
6466
const logFile = path.join(dir, 'matches.jsonl');
@@ -107,6 +109,7 @@ export async function activate(api) {
107109
sides: [a, b],
108110
commits: [null, null],
109111
timer: null,
112+
interRoundMs,
110113
done: false,
111114
};
112115
rooms.set(matchId, room);
@@ -150,7 +153,7 @@ export async function activate(api) {
150153
if (s.socket) send(s.socket, { type: 'result', round: room.st.round - 1, scorer, score: room.st.score, deaths, state: publicState(room.st) });
151154
}
152155
if (end) endRoom(room, room.st.winner, false);
153-
else beginPhase(room);
156+
else room.timer = setTimeout(() => beginPhase(room), room.interRoundMs);
154157
}
155158

156159
function endRoom(room, winner, forfeit) {

globs/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { startJss, probePort } from '../helpers.js';
2424
const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
2525
const entry = {
2626
id: 'globs', module: path.join(__dirname, 'plugin.js'), prefix: '/globs',
27-
config: { aimTimeMs: 200, queueBotFallbackMs: 500 },
27+
config: { aimTimeMs: 200, queueBotFallbackMs: 500, interRoundMs: 0 },
2828
};
2929

3030
function openSock(url, headers) {

0 commit comments

Comments
 (0)