created prestart message: add 2 second delay before starting public games to allow all players to connect

This commit is contained in:
Evan
2025-04-03 15:42:25 -07:00
parent f09801fe3e
commit 950344c0bd
8 changed files with 105 additions and 33 deletions
+10 -5
View File
@@ -64,11 +64,16 @@ export class GameManager {
const phase = game.phase();
if (phase == GamePhase.Active) {
if (!game.hasStarted()) {
try {
game.start();
} catch (error) {
this.log.error(`error starting game ${id}: ${error}`);
}
// Prestart tells clients to start loading the game.
game.prestart();
// Start game on delay to allow time for clients to connect.
setTimeout(() => {
try {
game.start();
} catch (error) {
this.log.error(`error starting game ${id}: ${error}`);
}
}, 2000);
}
}