make names bigger, see farther out

This commit is contained in:
evanpelle
2024-09-03 19:28:09 -07:00
parent 1f590d0f4a
commit d4a3774060
4 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -88,9 +88,9 @@
--- v2 Release
* put number of troops ui DONE 9/3/2024
* names don't appear when zoomed out DONE 9/3/2024
* make names bigger DONE 9/3/2024
* boats leave trails
* names don't appear when zoomed out
* make names bigger
* send boat even if touching
* directed expansion
* more random names for game id & client id
+1 -1
View File
@@ -130,6 +130,6 @@ 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 heightConstrained = rectangle.height / name.length;
const heightConstrained = rectangle.height / 3;
return Math.min(widthConstrained, heightConstrained);
}
+3 -3
View File
@@ -86,11 +86,11 @@ export class NameRenderer {
isVisible(render: RenderInfo, min: Cell, max: Cell): boolean {
const ratio = (max.x - min.x) / Math.max(20, (render.boundingBox.max.x - render.boundingBox.min.x))
if (render.player.isBot()) {
if (ratio > 25) {
if (ratio > 35) {
return false
}
} else {
if (ratio > 30) {
if (ratio > 35) {
return false
}
}
@@ -124,7 +124,7 @@ export class NameRenderer {
context.fillText(render.player.name(), nameCenterX, nameCenterY - render.fontSize / 2);
context.font = `bold ${render.fontSize}px ${this.theme.font()}`;
context.fillText(renderTroops(render.player.troops()), nameCenterX, nameCenterY + render.fontSize);
}
}
+6 -6
View File
@@ -26,12 +26,12 @@ export const devConfig = new class extends DefaultConfig {
return 5000
}
troopAdditionRate(player: Player): number {
let max = Math.sqrt(player.numTilesOwned()) * 2000 + 10000 + 10000
max = Math.min(max, 1_000_000)
// troopAdditionRate(player: Player): number {
// let max = Math.sqrt(player.numTilesOwned()) * 2000 + 10000 + 10000
// max = Math.min(max, 1_000_000)
let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 200 * 100
// let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 200 * 100
return Math.min(player.troops() + toAdd, max)
}
// return Math.min(player.troops() + toAdd, max)
// }
}