fakehumans send boats, improved map

This commit is contained in:
evanpelle
2024-09-08 20:21:39 -07:00
parent 8331047a9b
commit a7ad8790aa
19 changed files with 437 additions and 55 deletions
-1
View File
@@ -80,7 +80,6 @@ class Client {
const nextGame = document.getElementById('next-game');
nextGame.textContent = `Next Game: ${nextLobby.id.substring(0, 3)}`
}
}
async fetchLobbies(): Promise<Lobby[]> {
+5 -3
View File
@@ -11,7 +11,6 @@ import {and, bfs, dist, manhattanDist} from "../core/Util";
import {TerrainRenderer} from "./graphics/TerrainRenderer";
export function createClientGame(name: string, clientID: ClientID, playerID: PlayerID, ip: string | null, gameID: GameID, config: Config, terrainMap: TerrainMap): ClientGame {
let eventBus = new EventBus()
let game = createGame(terrainMap, eventBus, config)
@@ -28,7 +27,7 @@ export function createClientGame(name: string, clientID: ClientID, playerID: Pla
game,
gameRenderer,
new InputHandler(eventBus),
new Executor(game)
new Executor(game, gameID)
)
}
@@ -118,6 +117,8 @@ export class ClientGame {
}
public start() {
console.log('version 3')
this.isActive = true
// TODO: make each class do this, or maybe have client intercept all requests?
//this.eventBus.on(TickEvent, (e) => this.tick(e))
@@ -131,7 +132,8 @@ 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(1))
console.log('!!! number fake humans 15')
this.gs.addExecution(...this.executor.fakeHumanExecutions(15))
this.intervalID = setInterval(() => this.tick(), 10);
}
+1 -1
View File
@@ -130,7 +130,7 @@ export function largestRectangleInHistogram(widths: number[]): Rectangle {
export function calculateFontSize(rectangle: Rectangle, name: string): number {
// This is a simplified calculation. You might want to adjust it based on your specific font and rendering system.
const widthConstrained = rectangle.width / name.length;
const widthConstrained = rectangle.width / name.length * 2;
const heightConstrained = rectangle.height / 3;
return Math.min(widthConstrained, heightConstrained);
}
+1 -1
View File
@@ -10,7 +10,7 @@
<body>
<div class="content">
<h1>OpenFront.io</h1>
<h2>(v0.3.5)</h2>
<h2>(v0.3.6)</h2>
<div id="username-container">
<input type="text" id="username" placeholder="Enter your username">
</div>