use europe map

This commit is contained in:
evanpelle
2024-10-09 10:51:56 -07:00
parent 149d38c907
commit bb8827c8ad
7 changed files with 222 additions and 8 deletions
+22
View File
@@ -0,0 +1,22 @@
171, 171 Iceland
477, 473 Ireland
650, 500 England
560, 800 Spain
726, 616 France
1050, 745 Italy
872, 634 Switzerland
960, 271 Norway
1095, 336 Sweden
1403, 235 Finland
775, 541 Belgium
868, 487 Netherlands
949, 548 Germany
1017, 628 Austria
1120, 477 Poland
1030, 589 Czechia
1540, 602 Ukraine
1500, 440 Belarus
1424, 754 Romania
1580, 834 Turkiye
525, 955 Morocco
1674, 449 Russia
File diff suppressed because one or more lines are too long
+183
View File
@@ -0,0 +1,183 @@
{
"name": "Europe",
"width": 2000,
"height": 1000,
"nations": [
{
"coordinates": [
171,
171
],
"name": "Iceland",
"strength": 1
},
{
"coordinates": [
477,
473
],
"name": "Ireland",
"strength": 1
},
{
"coordinates": [
650,
500
],
"name": "England",
"strength": 3
},
{
"coordinates": [
560,
800
],
"name": "Spain",
"strength": 2
},
{
"coordinates": [
726,
616
],
"name": "France",
"strength": 2
},
{
"coordinates": [
1050,
745
],
"name": "Italy",
"strength": 1
},
{
"coordinates": [
872,
634
],
"name": "Switzerland",
"strength": 1
},
{
"coordinates": [
960,
271
],
"name": "Norway",
"strength": 1
},
{
"coordinates": [
1095,
336
],
"name": "Sweden",
"strength": 1
},
{
"coordinates": [
1403,
235
],
"name": "Finland",
"strength": 1
},
{
"coordinates": [
775,
541
],
"name": "Belgium",
"strength": 1
},
{
"coordinates": [
868,
487
],
"name": "Netherlands",
"strength": 1
},
{
"coordinates": [
949,
548
],
"name": "Germany",
"strength": 1
},
{
"coordinates": [
1017,
628
],
"name": "Austria",
"strength": 1
},
{
"coordinates": [
1120,
477
],
"name": "Poland",
"strength": 1
},
{
"coordinates": [
1030,
589
],
"name": "Czechia",
"strength": 1
},
{
"coordinates": [
1540,
602
],
"name": "Ukraine",
"strength": 1
},
{
"coordinates": [
1500,
440
],
"name": "Belarus",
"strength": 1
},
{
"coordinates": [
1424,
754
],
"name": "Romania",
"strength": 1
},
{
"coordinates": [
1580,
834
],
"name": "Turkiye",
"strength": 1
},
{
"coordinates": [
525,
955
],
"name": "Morocco",
"strength": 1
},
{
"coordinates": [
1674,
449
],
"name": "Russia",
"strength": 3
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 744 KiB

+11 -3
View File
@@ -36,9 +36,14 @@ export class FakeHumanExecution implements Execution {
if (this.mg.inSpawnPhase()) {
if (ticks % this.random.nextInt(5, 30) == 0) {
const rl = this.randomLand()
if (rl == null) {
console.warn(`cannot spawn ${this.playerInfo.name}`)
return
}
this.mg.addExecution(new SpawnExecution(
this.playerInfo,
this.randomLand().cell()
rl.cell()
))
}
return
@@ -195,9 +200,11 @@ export class FakeHumanExecution implements Execution {
this.sendBoat(tries + 1, oceanShore)
}
randomLand(): Tile {
randomLand(): Tile | null {
const delta = 25
while (true) {
let tries = 0
while (tries < 50) {
tries++
const cell = new Cell(
this.random.nextInt(this.cell.x - delta, this.cell.x + delta),
this.random.nextInt(this.cell.y - delta, this.cell.y + delta)
@@ -213,6 +220,7 @@ export class FakeHumanExecution implements Execution {
return tile
}
}
return null
}
sendAttack(toAttack: Player | TerraNullius) {
+2 -2
View File
@@ -1,6 +1,6 @@
import {Cell, TerrainType} from './Game';
import binAsString from "!!binary-loader!../../../resources/maps/WorldMap.bin";
import worldMapInfo from "../../../resources/maps/WorldMap.json"
import binAsString from "!!binary-loader!../../../resources/maps/Europe.bin";
import worldMapInfo from "../../../resources/maps/Europe.json"
export interface NationMap {
name: string;
+3 -3
View File
@@ -8,7 +8,7 @@ import {fileURLToPath} from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const mapName = "Europe"
interface Coord {
x: number;
@@ -44,7 +44,7 @@ export class Terrain {
}
export async function loadTerrainMap(): Promise<void> {
const imagePath = path.resolve(__dirname, '..', '..', 'resources', 'maps', 'WorldMap.png');
const imagePath = path.resolve(__dirname, '..', '..', 'resources', 'maps', mapName + '.png');
const readStream = createReadStream(imagePath);
const img = await PImage.decodePNGFromStream(readStream);
@@ -92,7 +92,7 @@ export async function loadTerrainMap(): Promise<void> {
processDistToLand(shorelineWaters, terrain)
processOcean(terrain)
const packed = packTerrain(terrain)
const outputPath = path.join(__dirname, '..', '..', 'resources', 'maps', 'WorldMap.bin');
const outputPath = path.join(__dirname, '..', '..', 'resources', 'maps', mapName + '.bin');
fs.writeFile(outputPath, packed);
}