Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(society): the sea never breaks through the beach, marsh pools are still water, and the fields calm down

rubenluetke10-beep5114966ee571
diff --git a/jarvis/ui/web/frontend/src/components/society/world/Terrain.tsx b/jarvis/ui/web/frontend/src/components/society/world/Terrain.tsx
index e86189da23..7beb01c932 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/Terrain.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/Terrain.tsx
@@ -51,6 +51,8 @@ export function Terrain() {
/** The sea plane — far larger than the island so its edge is never in view. */
const SEA_SIZE_M = 1400;
+/** The plane's rest height: below the water line, so a raised wave stays under the beach. */
+const SEA_REST_Y = -0.1;
/** Vertices per side: 5 m cells, fine enough for 9 m breakers. */
const SEA_SEGMENTS = 280;
/** How many tiles out from the coast the shore texture measures distance. */
@@ -196,7 +198,7 @@ const WATER_VERTEX = /* glsl */ `
vec2 d2 = normalize(vec2(-0.5, 0.87));
vec2 d3 = normalize(vec2(0.3, -0.95));
float k1 = 6.2832 / 34.0, k2 = 6.2832 / 19.0, k3 = 6.2832 / 9.5;
- float a1 = 0.26, a2 = 0.16, a3 = 0.08;
+ float a1 = 0.1, a2 = 0.06, a3 = 0.035;
float p1 = dot(p, d1) * k1 - time * 0.9;
float p2 = dot(p, d2) * k2 - time * 1.25;
float p3 = dot(p, d3) * k3 - time * 1.9;
@@ -211,14 +213,16 @@ const WATER_VERTEX = /* glsl */ `
float crest = sin(phase);
// Sharpen the front face: a wave that is about to break leans forward.
float steep = crest + 0.35 * sin(2.0 * phase + 1.2);
- float ab = 0.42 * shoal;
+ float ab = 0.13 * shoal;
h += ab * steep;
// Its slope points along the shore gradient (toward the coast).
slope += ab * 0.72 * cos(phase) * grad;
+ // The surface itself barely rises (it must never break through the sand, which
+ // sits 0.35 m up); the LIGHT does the work: normals are steepened for shading.
vec3 displaced = world + vec3(0.0, h, 0.0);
vWorld = displaced;
- vNormal = normalize(vec3(-slope.x, 1.0, -slope.y));
+ vNormal = normalize(vec3(-slope.x * 2.6, 1.0, -slope.y * 2.6));
vDist = dist;
vCrest = steep * shoal;
gl_Position = projectionMatrix * viewMatrix * vec4(displaced, 1.0);
@@ -399,7 +403,7 @@ export function Water({ paused }: { paused: boolean }) {
return (
<group>
- <mesh geometry={geometry} material={material} rotation={[-Math.PI / 2, 0, 0]} />
+ <mesh geometry={geometry} material={material} rotation={[-Math.PI / 2, 0, 0]} position={[0, SEA_REST_Y, 0]} />
{/* the wash: a sheet just above the beach's sand */}
<mesh
geometry={washGeometry}
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
index c2bd05ceb1..47e49837fd 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
@@ -393,6 +393,10 @@ describe("islandLayout", () => {
expect(content.festoonPoles.length).toBe(8);
expect(content.lamps.length).toBeGreaterThan(50);
expect(content.reeds.length).toBeGreaterThan(40);
+ // Marsh pools are still water, their own kind: the sea's surf never reaches them.
+ let pools = 0;
+ for (let i = 0; i < map.kind.length; i++) if (map.kind[i] === TileKind.pool) pools++;
+ expect(pools).toBeGreaterThan(10);
const [cx, cz] = worldToTile(content.campfire.x, content.campfire.z);
expect(map.kind[tileIndex(map, cx, cz)]).toBe(TileKind.sand);
});
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
index a5553bc29d..569fc24e0d 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
@@ -101,6 +101,8 @@ export const TileKind = {
scree: 16,
/** The quarry floor around the mine. */
quarry: 17,
+ /** Still water in the marsh: a pool at sea level, no surf, no foam. */
+ pool: 18,
} as const;
export type TileKind = (typeof TileKind)[keyof typeof TileKind];
@@ -871,7 +873,11 @@ function buildTerrain(map: IslandMap): void {
if (map.kind[i] !== TileKind.marsh) continue;
const nx = (tx + 0.5 - C) / C;
const nz = (tz + 0.5 - C) / C;
- if (fbm(nx * 16 + 2, nz * 16 + 6, ISLAND_SEED + 21) > 0.64) paintWater(map, i);
+ if (fbm(nx * 16 + 2, nz * 16 + 6, ISLAND_SEED + 21) > 0.64) {
+ map.kind[i] = TileKind.pool;
+ map.level[i] = 0;
+ map.blocked[i] = 1;
+ }
}
}
@@ -1268,7 +1274,7 @@ function placeReeds(map: IslandMap): Post[] {
[0, 1],
[0, -1],
] as const) {
- if (map.kind[tileIndex(map, tx + dx, tz + dz)] === TileKind.water) pool = true;
+ if (map.kind[tileIndex(map, tx + dx, tz + dz)] === TileKind.pool) pool = true;
}
const density = pool ? 0.8 : 0.28;
if (hash2(tx, tz, ISLAND_SEED + 61) > density) continue;
@@ -1396,7 +1402,7 @@ function placeBoulders(map: IslandMap): Boulder[] {
for (let tx = 1; tx < map.size - 1; tx++) {
const i = tileIndex(map, tx, tz);
const k = map.kind[i];
- if (k === TileKind.water || k === TileKind.path || k === TileKind.plaza || k === TileKind.dock) continue;
+ if (k === TileKind.water || k === TileKind.pool || k === TileKind.path || k === TileKind.plaza || k === TileKind.dock) continue;
if (Math.hypot(tx + 0.5 - C, tz + 0.5 - C) < HEDGE_RING_TILES + 4) continue;
let density: number;
if (k === TileKind.rock || k === TileKind.snow) density = 0.05;
diff --git a/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.test.ts b/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.test.ts
index 1ca1038ac4..b1ffc90e39 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.test.ts
@@ -28,7 +28,7 @@ describe("terrainGeometry", () => {
if (nor.getY(v) === 1) heights.add(Math.round(pos.getY(v) * 100) / 100);
}
// Levels 1..9 plus the dock: never a stray height.
- expect(heights.size).toBeLessThanOrEqual(LEVEL_Y.length);
+ expect(heights.size).toBeLessThanOrEqual(LEVEL_Y.length + 1); // levels 0..9 (the pools sit at 0) plus the dock
const i = tileIndex(map, CENTER_TILE, CENTER_TILE);
expect(map.kind[i]).toBe(TileKind.plaza);
});
diff --git a/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.ts b/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.ts
index 1e64b6306e..5674090e9f 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/terrainGeometry.ts
@@ -148,7 +148,7 @@ export function buildTerrainGeometry(map: IslandMap): BufferGeometry {
// of a stylised village is shaded.
let factor = tileAo(map, tx, tz, y);
// Aerial tint: the high ground is a touch lighter, the low ground a touch deeper.
- if (kind !== TileKind.dock) factor *= 1 + (level - PLATEAU_LEVEL) * LEVEL_TINT;
+ if (kind !== TileKind.dock && kind !== TileKind.pool) factor *= 1 + (level - PLATEAU_LEVEL) * LEVEL_TINT;
// The wet line: sand with the sea beside it.
if (kind === TileKind.sand && touchesWater(map, tx, tz)) factor *= WET_SAND;
const base = color(shades.top[topIdx]);
diff --git a/jarvis/ui/web/frontend/src/components/society/world/worldPalette.ts b/jarvis/ui/web/frontend/src/components/society/world/worldPalette.ts
index 5b2b4a7100..5c390e6a4a 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/worldPalette.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/worldPalette.ts
@@ -36,10 +36,11 @@ export const TILE_COLORS: Record<TileKind, TileShades> = {
[TileKind.snow]: { top: ["#f6f9fc", "#e9eff6"], side: "#8f92a3" },
[TileKind.heath]: { top: ["#b48ec6", "#a583b8"], side: "#7c6a4c" },
[TileKind.dry]: { top: ["#dcd07e", "#cfc370"], side: "#a08a55" },
- [TileKind.farm]: { top: ["#c9a35a", "#8fbf55"], side: "#8e6a44" },
- [TileKind.marsh]: { top: ["#5f9e70", "#4f8c62"], side: "#4c5e3c" },
+ [TileKind.farm]: { top: ["#bfb06a", "#9ac45e"], side: "#8e6a44" },
+ [TileKind.marsh]: { top: ["#74b07e", "#67a271"], side: "#4c5e3c" },
[TileKind.scree]: { top: ["#918e88", "#85827b"], side: "#6f6e7c" },
[TileKind.quarry]: { top: ["#a2988a", "#948a7c"], side: "#6f6e7c" },
+ [TileKind.pool]: { top: ["#4fa2c6", "#4a9bbf"], side: "#2c6fa8" },
};
/** Water: the animated surface, from the turquoise shallows to the open sea. */