mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 07:50:45 +00:00
delete num fake humans config, this is set by map json file
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -31,7 +31,6 @@ export interface Config {
|
||||
gameCreationRate(): number
|
||||
lobbyLifetime(): number
|
||||
numBots(): number
|
||||
numFakeHumans(gameID: GameID): number
|
||||
numSpawnPhaseTurns(): number
|
||||
|
||||
startTroops(playerInfo: PlayerInfo): number
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user