added deployment

This commit is contained in:
evanpelle
2024-08-13 20:07:20 -07:00
parent efd5f65787
commit 001722bd59
11 changed files with 90 additions and 70 deletions
+5 -3
View File
@@ -3,8 +3,8 @@ import {Client} from "./Client";
import {Lobby} from "./Lobby";
import {GameServer} from "./GameServer";
import {Config} from "../core/configuration/Config";
import {generateUniqueID} from "../core/Util";
import {defaultConfig} from "../core/configuration/DefaultConfig";
import {PseudoRandom} from "../core/PseudoRandom";
export class GameManager {
@@ -14,6 +14,8 @@ export class GameManager {
private games: Map<GameID, GameServer> = new Map()
private random = new PseudoRandom(123)
constructor(private settings: Config) { }
@@ -42,7 +44,7 @@ export class GameManager {
}
startGame(lobby: Lobby) {
const gs = new GameServer(generateUniqueID(), lobby.clients, defaultConfig)
const gs = new GameServer(this.random.nextID(), lobby.clients, defaultConfig)
this.games.set(gs.id, gs)
gs.start()
}
@@ -61,7 +63,7 @@ export class GameManager {
if (now > this.lastNewLobby + this.settings.lobbyCreationRate()) {
this.lastNewLobby = now
this.addLobby(new Lobby(generateUniqueID(), this.settings.lobbyLifetime()))
this.addLobby(new Lobby(this.random.nextID(), this.settings.lobbyLifetime()))
}
}
}