From e1f7d395f26eaaac92386b6e5d31105f115140b2 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Tue, 8 Oct 2024 20:45:18 -0700 Subject: [PATCH] delete num fake humans config, this is set by map json file --- src/client/Client.ts | 22 ---------------------- src/client/ClientGame.ts | 2 +- src/core/configuration/Config.ts | 1 - src/core/configuration/DefaultConfig.ts | 3 --- src/core/configuration/DevConfig.ts | 4 ---- src/core/execution/ExecutionManager.ts | 2 +- 6 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/client/Client.ts b/src/client/Client.ts index 70c76ee49..6198453b8 100644 --- a/src/client/Client.ts +++ b/src/client/Client.ts @@ -145,28 +145,6 @@ class Client { g.stop(); }); } - - numFakeHumans(lobby: Lobby): number { - const gameHash = simpleHash(lobby.id) - const totalNumFakeHumans = this.config.numFakeHumans(lobby.id) - const timeLeft = lobby.msUntilStart - const rand = new PseudoRandom(gameHash) - const startTimes: number[] = [] - const lobbyTime = this.config.gameCreationRate() - for (let i = 0; i < totalNumFakeHumans; i++) { - startTimes.push(rand.nextInt(0, lobbyTime)) - } - - startTimes.sort() - - let currNumFakeHumans = 0 - for (const joinTime of startTimes) { - if (timeLeft < joinTime) { - currNumFakeHumans++ - } - } - return currNumFakeHumans - } } function refreshUsername(): string { diff --git a/src/client/ClientGame.ts b/src/client/ClientGame.ts index 63ec27132..45b07aabc 100644 --- a/src/client/ClientGame.ts +++ b/src/client/ClientGame.ts @@ -98,7 +98,7 @@ export class ClientGame { this.renderer.initialize() this.input.initialize() this.gs.addExecution(...this.executor.spawnBots(this.gs.config().numBots())) - this.gs.addExecution(...this.executor.fakeHumanExecutions(this.gs.config().numFakeHumans(this.gameID))) + this.gs.addExecution(...this.executor.fakeHumanExecutions()) this.gs.addExecution(new WinCheckExecution(this.eventBus)) this.intervalID = setInterval(() => this.tick(), 10); diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 5b45b63a2..c7b8a3c5c 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -31,7 +31,6 @@ export interface Config { gameCreationRate(): number lobbyLifetime(): number numBots(): number - numFakeHumans(gameID: GameID): number numSpawnPhaseTurns(): number startTroops(playerInfo: PlayerInfo): number diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 65018cb4f..c7b4b16e0 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -46,9 +46,6 @@ export class DefaultConfig implements Config { numBots(): number { return 400 } - numFakeHumans(gameID: GameID): number { - return simpleHash(gameID) % 40 - } turnIntervalMs(): number { return 100 } diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 455b4ccd0..f6c2a1193 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -26,10 +26,6 @@ export const devConfig = new class extends DefaultConfig { // return 10 * 10 // } - // numFakeHumans(gameID: GameID): number { - // return 1 - // } - // startTroops(playerInfo: PlayerInfo): number { // // if (playerInfo.isBot) { // // return 5000 diff --git a/src/core/execution/ExecutionManager.ts b/src/core/execution/ExecutionManager.ts index 128644869..80ba1d221 100644 --- a/src/core/execution/ExecutionManager.ts +++ b/src/core/execution/ExecutionManager.ts @@ -85,7 +85,7 @@ export class Executor { return new BotSpawner(this.gs, this.gameID).spawnBots(numBots).map(i => this.createExec(i)) } - fakeHumanExecutions(numFakes: number): Execution[] { + fakeHumanExecutions(): Execution[] { const execs = [] for (const nation of this.gs.nations()) { execs.push(new FakeHumanExecution(