mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:30:43 +00:00
make bots more likely to attack larger border
This commit is contained in:
@@ -54,9 +54,12 @@
|
||||
* BUG: players attack each other same time creates islands DONE 8/28/2024
|
||||
* make bot spawn better DONE 8/28/2024
|
||||
* make UX for attacking TerraNullius by boat better DONE 8/29/2024
|
||||
* make bot territory less funky (more likely attack neighbors with larger border)
|
||||
* make bot territory less funky (more likely attack neighbors with larger border) DONE 8/29/2024
|
||||
* PERF: use hierarchical a* search for boats
|
||||
* PERF: precompute spawns
|
||||
* PERF: load terrain map async
|
||||
* PERF: enable CDN
|
||||
* enable load balancing metrics
|
||||
* end game when no players left (or after 1 hour or so?)
|
||||
* boats can go around the world
|
||||
* Add terrain elevation to map
|
||||
|
||||
@@ -19,7 +19,7 @@ export const devConfig = new class extends DefaultConfig {
|
||||
return devPlayerConfig
|
||||
}
|
||||
numBots(): number {
|
||||
return 50
|
||||
return 250
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export class BotExecution implements Execution {
|
||||
private random: PseudoRandom;
|
||||
private attackRate: number
|
||||
private mg: MutableGame
|
||||
private neighborsTerra = true
|
||||
private neighborsTerraNullius = true
|
||||
|
||||
|
||||
constructor(private bot: MutablePlayer) {
|
||||
@@ -37,26 +37,30 @@ export class BotExecution implements Execution {
|
||||
return
|
||||
}
|
||||
|
||||
if (ticks % this.attackRate == 0) {
|
||||
if (this.neighborsTerra) {
|
||||
for (const b of this.bot.borderTiles()) {
|
||||
for (const n of b.neighbors()) {
|
||||
if (n.owner() == this.mg.terraNullius() && n.isLand()) {
|
||||
this.sendAttack(this.mg.terraNullius())
|
||||
return
|
||||
}
|
||||
if (ticks % this.attackRate != 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.neighborsTerraNullius) {
|
||||
for (const b of this.bot.borderTiles()) {
|
||||
for (const n of b.neighbors()) {
|
||||
if (n.owner() == this.mg.terraNullius() && n.isLand()) {
|
||||
this.sendAttack(this.mg.terraNullius())
|
||||
return
|
||||
}
|
||||
}
|
||||
this.neighborsTerra = false
|
||||
}
|
||||
|
||||
const ns = this.bot.neighbors()
|
||||
if (ns.length == 0) {
|
||||
return
|
||||
}
|
||||
const toAttack = ns[this.random.nextInt(0, ns.length)]
|
||||
this.sendAttack(toAttack)
|
||||
this.neighborsTerraNullius = false
|
||||
}
|
||||
|
||||
const border = Array.from(this.bot.borderTiles()).flatMap(t => t.neighbors()).filter(t => t.hasOwner() && t.owner() != this.bot)
|
||||
|
||||
if (border.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
const toAttack = border[this.random.nextInt(0, border.length)]
|
||||
this.sendAttack(toAttack.owner())
|
||||
}
|
||||
|
||||
sendAttack(toAttack: Player | TerraNullius) {
|
||||
|
||||
Reference in New Issue
Block a user