mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 06:30:42 +00:00
rebalancing
This commit is contained in:
@@ -97,11 +97,12 @@
|
||||
* more random names for game id & client id DONE 9/5/2024
|
||||
* BUG: attacks speed up DONE 9/6/2024
|
||||
* rebalance income DONE 9/7/2024
|
||||
* Make fake humans
|
||||
* BUG: when clicking on enemy sometimes boat goes all the way around
|
||||
|
||||
--- v3 Release
|
||||
|
||||
* Make fake humans
|
||||
* BUG: when clicking on enemy sometimes boat goes all the way around
|
||||
* names dissappear too much (maybe screen size)
|
||||
* directed expansion
|
||||
* UI: win condition & popup
|
||||
* UI: boats
|
||||
|
||||
Generated
+27
-4
@@ -25,6 +25,7 @@
|
||||
"protobufjs": "^7.3.2",
|
||||
"pureimage": "^0.4.13",
|
||||
"typia": "^6.5.2",
|
||||
"uuid": "^10.0.0",
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
@@ -37,6 +38,7 @@
|
||||
"@types/mocha": "^10.0.7",
|
||||
"@types/node": "^22.5.2",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/ws": "^8.5.11",
|
||||
"babel-jest": "^29.7.0",
|
||||
"binary-base64-loader": "^1.0.0",
|
||||
@@ -4248,6 +4250,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.5.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.11.tgz",
|
||||
@@ -11602,6 +11611,16 @@
|
||||
"websocket-driver": "^0.7.4"
|
||||
}
|
||||
},
|
||||
"node_modules/sockjs/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/socks": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
|
||||
@@ -12745,10 +12764,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@types/mocha": "^10.0.7",
|
||||
"@types/node": "^22.5.2",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/ws": "^8.5.11",
|
||||
"babel-jest": "^29.7.0",
|
||||
"binary-base64-loader": "^1.0.0",
|
||||
@@ -66,6 +67,7 @@
|
||||
"protobufjs": "^7.3.2",
|
||||
"pureimage": "^0.4.13",
|
||||
"typia": "^6.5.2",
|
||||
"uuid": "^10.0.0",
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
|
||||
@@ -4,9 +4,10 @@ import {loadTerrainMap, TerrainMap} from "../core/TerrainMapLoader";
|
||||
import {ClientGame, createClientGame} from "./ClientGame";
|
||||
import backgroundImage from '../../resources/images/TerrainMapFrontPage.png';
|
||||
import favicon from '../../resources/images/Favicon.png';
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
|
||||
import './styles.css';
|
||||
import {generateUniqueId} from "../core/Util";
|
||||
|
||||
|
||||
class Client {
|
||||
@@ -120,7 +121,7 @@ class Client {
|
||||
console.log(`got ip ${clientIP}`)
|
||||
this.game = createClientGame(
|
||||
getUsername(),
|
||||
generateUniqueId(),
|
||||
uuidv4(),
|
||||
clientIP,
|
||||
lobby.id,
|
||||
getConfig(),
|
||||
|
||||
@@ -242,6 +242,10 @@ export class ClientGame {
|
||||
|
||||
let borderTileClosest = 10000000
|
||||
let enemyShoreClosest = 10000
|
||||
if (borderWithDists.length == 0 && enemyShoreDists.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (bordersWithDists.length > 0) {
|
||||
borderTileClosest = borderWithDists[0].dist
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>OpenFront.io</h1>
|
||||
<h2>(v0.3.0)</h2>
|
||||
<h2>(v0.3.5)</h2>
|
||||
<div id="username-container">
|
||||
<input type="text" id="username" placeholder="Enter your username">
|
||||
</div>
|
||||
|
||||
+3
-7
@@ -1,3 +1,6 @@
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
|
||||
import {Cell, Player, Tile} from "./Game";
|
||||
|
||||
export function manhattanDist(c1: Cell, c2: Cell): number {
|
||||
@@ -97,11 +100,4 @@ export function getMode(list: string[]): string {
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
export function generateUniqueId(): string {
|
||||
if (typeof crypto === 'undefined' || !crypto.randomUUID) {
|
||||
throw new Error('crypto.randomUUID is not supported in this environment');
|
||||
}
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
@@ -31,28 +31,32 @@ export class DefaultConfig implements Config {
|
||||
|
||||
attackLogic(attacker: Player, defender: Player | TerraNullius, tileToConquer: Tile): {attackerTroopLoss: number; defenderTroopLoss: number; tilesPerTickUsed: number} {
|
||||
let mag = 0
|
||||
let speed = 0
|
||||
switch (tileToConquer.terrain()) {
|
||||
case TerrainType.Plains:
|
||||
mag = 1
|
||||
mag = 5
|
||||
speed = 5
|
||||
break
|
||||
case TerrainType.Highland:
|
||||
mag = 15
|
||||
speed = 10
|
||||
break
|
||||
case TerrainType.Mountain:
|
||||
mag = 40
|
||||
mag = 45
|
||||
speed = 15
|
||||
break
|
||||
}
|
||||
if (defender.isPlayer()) {
|
||||
return {
|
||||
attackerTroopLoss: within(defender.troops() / attacker.troops() * mag, 1, 1000),
|
||||
defenderTroopLoss: within(attacker.troops() / defender.troops(), 1, 1000),
|
||||
tilesPerTickUsed: within(attacker.numTilesOwned() / defender.numTilesOwned(), 1, 5) * mag
|
||||
tilesPerTickUsed: within(attacker.numTilesOwned() / defender.numTilesOwned() / 2, 1, 5) * speed
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
attackerTroopLoss: mag,
|
||||
defenderTroopLoss: 0,
|
||||
tilesPerTickUsed: Math.max(mag / 2, 1)
|
||||
tilesPerTickUsed: Math.floor(Math.max(speed, 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import {PseudoRandom} from "../core/PseudoRandom";
|
||||
import WebSocket from 'ws';
|
||||
import {ClientID, GameID} from "../core/Schemas";
|
||||
import {Client} from "./Client";
|
||||
import {generateUniqueId} from "../core/Util";
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
|
||||
|
||||
export class GameManager {
|
||||
@@ -38,7 +39,7 @@ export class GameManager {
|
||||
const now = Date.now()
|
||||
if (now > this.lastNewLobby + this.config.gameCreationRate()) {
|
||||
this.lastNewLobby = now
|
||||
const id = generateUniqueId()
|
||||
const id = uuidv4()
|
||||
lobbies.push(new GameServer(id, now, this.config))
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ gcloud compute ssh $INSTANCE_NAME --zone us-central1-a --command 'docker kill $(
|
||||
|
||||
gcloud compute ssh $INSTANCE_NAME --zone us-central1-a --command 'docker rmi $(docker images -q) -f'
|
||||
|
||||
|
||||
# Update the GCE instance with the new container image
|
||||
gcloud compute instances update-container $INSTANCE_NAME \
|
||||
--container-image us-central1-docker.pkg.dev/openfrontio/openfrontio/game-server:$TAG \
|
||||
|
||||
Reference in New Issue
Block a user