mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:50:18 +00:00
improved terrain
This commit is contained in:
@@ -38,13 +38,16 @@
|
||||
* boats same color as owner DONE 8/19/2024
|
||||
* make coasts look better DONE 8/22/2024
|
||||
* only put imageDataOnce, draw territories on top DONE 8/23/2024
|
||||
* have boats not get close to shore
|
||||
* have boats not get close to shore DONE 8/23/2024
|
||||
* improve terrain colors
|
||||
* try vintage theme
|
||||
* BUG: boat doesn't work if on lake if other player not on same lake
|
||||
* Allow boats to attack TerraNullius
|
||||
* add shader to dim border
|
||||
* remove player.info()
|
||||
* fix enemy islands when attacking
|
||||
* BUG: ocean is considered TerraNullius
|
||||
* improve menu
|
||||
* give time to (re) spawn at start of game
|
||||
* BUG: ocean is considered TerraNullius ?
|
||||
* BUG: fix hotreload (priority queue breaks it)
|
||||
* PERF: use hierarchical a* search for boats
|
||||
* Add terrain elevation to map
|
||||
@@ -134,14 +134,6 @@ export class GameRenderer {
|
||||
}
|
||||
|
||||
tick() {
|
||||
// Create a temporary canvas for the game content
|
||||
// this.tempCanvas = document.createElement('canvas');
|
||||
// const tempCtx = this.tempCanvas.getContext('2d');
|
||||
// this.tempCanvas.width = this.gs.width();
|
||||
// this.tempCanvas.height = this.gs.height();
|
||||
|
||||
// // Put the ImageData on the temp canvas
|
||||
// tempCtx.putImageData(this.imageData, 0, 0);
|
||||
this.nameRenderer.tick()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import {Colord, colord} from "colord";
|
||||
import {Colord, colord, random} from "colord";
|
||||
import {PlayerID, Tile} from "../Game";
|
||||
import {Theme} from "./Config";
|
||||
import {time} from "console";
|
||||
import {PseudoRandom} from "../PseudoRandom";
|
||||
|
||||
export const pastelTheme = new class implements Theme {
|
||||
private rand = new PseudoRandom(123)
|
||||
|
||||
private background = colord({r: 100, g: 100, b: 100});
|
||||
private land = colord({r: 244, g: 243, b: 198});
|
||||
private shore = colord({r: 234, g: 343, b: 188});
|
||||
@@ -87,15 +90,22 @@ export const pastelTheme = new class implements Theme {
|
||||
}
|
||||
return this.land;
|
||||
} else {
|
||||
const w = this.water.rgba
|
||||
if (tile.isShorelineWater()) {
|
||||
return this.shorelineWater
|
||||
return colord({
|
||||
r: Math.max(w.r + 10, 0),
|
||||
g: Math.max(w.g + 10, 0),
|
||||
b: Math.max(w.b + 10, 0)
|
||||
})
|
||||
}
|
||||
return colord({
|
||||
r: Math.min(20, 255),
|
||||
g: Math.min(20, 255),
|
||||
b: Math.min(20 + tile.magnitude(), 255)
|
||||
})
|
||||
return this.water;
|
||||
if (tile.magnitude() < 5) {
|
||||
return colord({
|
||||
r: Math.max(w.r + 5 - tile.magnitude() / 2, 0),
|
||||
g: Math.max(w.g + 5 - tile.magnitude() / 2, 0),
|
||||
b: Math.max(w.b + 5 - tile.magnitude() / 2, 0)
|
||||
})
|
||||
}
|
||||
return this.water
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import PriorityQueue from "priority-queue-typescript";
|
||||
import {Boat, Cell, Execution, MutableBoat, MutableGame, MutablePlayer, Player, PlayerID, Tile} from "../Game";
|
||||
import {Boat, Cell, Execution, MutableBoat, MutableGame, MutablePlayer, Player, PlayerID, Tile, TileEvent} from "../Game";
|
||||
import {manhattanDist} from "../Util";
|
||||
import {AttackExecution} from "./AttackExecution";
|
||||
import {Config, PlayerConfig} from "../configuration/Config";
|
||||
@@ -60,7 +60,7 @@ export class BoatAttackExecution implements Execution {
|
||||
return
|
||||
}
|
||||
this.aStarPre = new AStar(this.src, this.dst)
|
||||
this.aStarPre.compute(10)
|
||||
this.aStarPre.compute(100)
|
||||
this.path = this.aStarPre.reconstructPath()
|
||||
if (this.path != null) {
|
||||
console.log(`got path ${this.path.map(t => t.cell().toString())}`)
|
||||
@@ -81,7 +81,7 @@ export class BoatAttackExecution implements Execution {
|
||||
}
|
||||
this.lastMove = ticks
|
||||
|
||||
if (!this.finalPath && this.aStarComplete.compute(10000)) {
|
||||
if (!this.finalPath && this.aStarComplete.compute(30000)) {
|
||||
this.path.push(...this.aStarComplete.reconstructPath())
|
||||
this.finalPath = true
|
||||
}
|
||||
@@ -167,7 +167,7 @@ export class AStar {
|
||||
for (const neighbor of this.current.neighbors()) {
|
||||
if (neighbor != this.dst && neighbor.isLand()) continue; // Skip non-water tiles
|
||||
|
||||
const tentativeGScore = this.gScore.get(this.current)! + 1; // Assuming uniform cost
|
||||
const tentativeGScore = this.gScore.get(this.current)! + 100 - neighbor.magnitude();
|
||||
|
||||
if (!this.gScore.has(neighbor) || tentativeGScore < this.gScore.get(neighbor)!) {
|
||||
this.cameFrom.set(neighbor, this.current);
|
||||
|
||||
Reference in New Issue
Block a user