schedule game duration based on time of day

This commit is contained in:
Evan
2025-03-02 09:39:54 -08:00
parent 3b492df56b
commit bad74a0488
7 changed files with 70 additions and 33 deletions
+18 -11
View File
@@ -3,6 +3,7 @@ import { GameConfig, GameID } from "../core/Schemas";
import { Client } from "./Client";
import { GamePhase, GameServer } from "./GameServer";
import { Difficulty, GameMapType, GameType } from "../core/game/Game";
import { isHighTrafficTime } from "./Util";
export class GameManager {
private games: Map<GameID, GameServer> = new Map();
@@ -25,17 +26,23 @@ export class GameManager {
}
createGame(id: GameID, gameConfig: GameConfig | undefined) {
const game = new GameServer(id, Date.now(), this.config, {
gameMap: GameMapType.World,
gameType: GameType.Private,
difficulty: Difficulty.Medium,
disableNPCs: false,
infiniteGold: false,
infiniteTroops: false,
instantBuild: false,
bots: 400,
...gameConfig,
});
const game = new GameServer(
id,
Date.now(),
isHighTrafficTime(),
this.config,
{
gameMap: GameMapType.World,
gameType: GameType.Private,
difficulty: Difficulty.Medium,
disableNPCs: false,
infiniteGold: false,
infiniteTroops: false,
instantBuild: false,
bots: 400,
...gameConfig,
},
);
this.games.set(id, game);
return game;
}