From 228fb1d2907face74757de7cf920d866919edaa1 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Tue, 3 Nov 2026 10:17:53 +0100 Subject: [PATCH] feat: mock: neighbours and barbarians spread over the six map tiers Co-Authored-By: Claude Opus 5.5 --- app/mock/neighbours.ts | 17 +++++++++-------- app/mock/server.ts | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/mock/neighbours.ts b/app/mock/neighbours.ts index d816be2..df8693e 100644 --- a/app/mock/neighbours.ts +++ b/app/mock/neighbours.ts @@ -1,6 +1,6 @@ // The mock's made-up neighbours: other players' villages round 0|0, so the map shows every -// kind of village (tribe mates, allies, a NAP, enemies, strangers) in every size from a few -// huts to a walled town. Each player holds a patch of land, like real players' villages +// kind of village (tribe mates, allies, a NAP, enemies, strangers) in every size from a +// hamlet to a walled town. Each player holds a patch of land, like real players' villages // bunch up. Placeholders only: the backend places real players. import type { MapRelationKind } from '~/types/map' @@ -27,13 +27,14 @@ const PLAYERS: Neighbour[] = [ ] const NAMES = ['Birkenhof', 'Dornach', 'Erlbach', 'Fichtau', 'Grauweiler', 'Haselgrund', 'Kalteneck', 'Lindwurm', 'Mühlstein', 'Nebelried', 'Ottersbach', 'Rotenfels'] -/** Points from the lowest to the top of each of the map's five size tiers, and how common each is. */ +/** Points from the lowest to the top of each of the map's six size tiers, and how common each is. */ const TIERS: [number, number, number][] = [ - [0.3, 40, 149], - [0.55, 150, 499], - [0.75, 500, 1499], - [0.9, 1500, 4999], - [1, 5000, 12000], + [0.28, 40, 299], + [0.5, 300, 999], + [0.7, 1000, 2999], + [0.84, 3000, 5999], + [0.93, 6000, 9999], + [1, 10000, 14000], ] const MAP_SIZE = 1000 diff --git a/app/mock/server.ts b/app/mock/server.ts index 1cac171..c9e20f6 100644 --- a/app/mock/server.ts +++ b/app/mock/server.ts @@ -770,7 +770,7 @@ function barbarianAt(x: number, y: number) { const r = (Math.imul(x * 73856093 ^ y * 19349663, 1274126177) >>> 0) / 4294967296 const near = Math.abs(x) <= 30 && Math.abs(y) <= 30 && !traderAt(x, y) && !neighbourAt(x, y) const size = (Math.imul(x * 19349663 ^ y * 83492791, 1274126177) >>> 0) / 4294967296 - return near && r < 0.08 ? { id: -((y - MAP_MIN) * MAP_SIZE + (x - MAP_MIN) + 1), name: BARBARIAN_NAME, points: 20 + Math.floor(size * size * 3000) } : null + return near && r < 0.08 ? { id: -((y - MAP_MIN) * MAP_SIZE + (x - MAP_MIN) + 1), name: BARBARIAN_NAME, points: 20 + Math.floor(size * size * 4000) } : null } /** The season's crown forts, barbarian in the mock, on the backend's ring round 0|0. */ @@ -1284,7 +1284,7 @@ function createVillage(state: MockState, user: AuthUser, worldId: number, now: n return v } -/** The player's second village a few fields from the first, its buildings grown to a town's (map size tier 3). */ +/** The player's second village a few fields from the first, its buildings grown for a while (map size tier 2). */ function grownVillage(state: MockState, user: AuthUser, first: MockVillage, now: number): MockVillage { const taken = new Set(state.villages.filter((v) => v.world_id === first.world_id).map((v) => `${v.x}|${v.y}`)) const free = ([dx, dy]: [number, number]) => {