A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
visual: larger, fewer hill olives to promo 03's crown size (L1, refs #34) (#655)
Eyal Golanf4ec0137cabe
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4a15c7a01..9b4f73715 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -461,6 +461,12 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBlines; that gap is read again after #519's grade). The surf zone widens from 900 m to 1.8 km, the breakers stand 450 mapart (300 m before) and the foam is whiter; a 200 m lace net, behind a new `foam` toggle, breaks each crest on its ownand fades to the old mean at the overview. All of it is in the water's own pass; the terrain function is unchanged.+- The hill olives are larger and fewer (visual gap L1, refs #34; owner, 15 October 2026: "~1.7x bigger, fewer+ trees"): the olive clumps' trees on the hills and mountains and the hill scatter's single olives are 1.7 times the+ size and 0.6 of them are kept, so their crowns match promo 03's hand-marked crown size at gameplay03 and cover about as+ much of the hills, with fewer instances. The olive clumps now keep off the hex-edge midpoints as the scatter does+ (owner: "Yes, add the guard now"). The scrub, the plain's and the valleys' olives, the mesh, the colours and the+ cypress rows are unchanged.- The map's region files (the 1948 sub-districts, the 1949 armistice lines, the 1948-49 control areas) are readfrom baked runtime forms at boot instead of being parsed as YAML (`tools/regions_bake.py`, refs #321), as thelocalities and the route paths are. The sub-districts are read once, for the camps and the region layers. A stale,diff --git a/unity/Assets/Scripts/Map/Kits/Vegetation.cs b/unity/Assets/Scripts/Map/Kits/Vegetation.csindex 93d2af59d..c0287254f 100644--- a/unity/Assets/Scripts/Map/Kits/Vegetation.cs+++ b/unity/Assets/Scripts/Map/Kits/Vegetation.cs@@ -75,6 +75,13 @@ namespace Statecraft.Game.Map.Kits/// <summary>The hills' scatter (Plant): one try per cell this wide (m), kept at about this share (a broad noise/// takes it from 0.4 to 1.6 times), this share of it low scrub (a small, squat olive), the rest single olives.</summary>public const float ScatterCellM = 800f, ScatterShare = 0.85f, ScrubShare = 0.35f;+ /// <summary>Visual gap L1 (issue #34; owner, 15 Oct 2026: "~1.7x bigger, fewer trees", the plan's option "hill olives+ /// only"): the hill olives (the clumps' trees on the hills and mountains and the scatter's single olives, not its+ /// scrub; the plain's and the valleys' olives are unchanged) are this many times the size, to+ /// promo 03's crowns as measured on screen at gameplay03, and only this share of them is kept, so the hills keep+ /// ground between the crowns and the instance count falls. CrownRadiusM, the mesh and every other tree are unchanged;+ /// the keep-outs (lots, routes, footprints, groves, grid marks) and the tree holes under units read the size.</summary>+ public const float HillOliveSize = 1.7f, HillOliveShare = 0.6f;/// <summary>The widest crown (m) the grove index is asked about (its query reach past a grove's disc).</summary>const float ScatterKeepM = 1500f;@@ -170,7 +177,8 @@ namespace Statecraft.Game.Map.Kits}}- // Olives over the hills and mountains: one jittered cell per 1.2 km, in clumps (Perlin), denser by the old towns.+ // Olives over the hills and mountains: one jittered cell per 1.2 km, in clumps (Perlin), denser by the old towns; the+ // trees on the hills and mountains HillOliveSize times the size, HillOliveShare of them kept.{var rnd = new KitRandom("olives", 13);// About 2.6 crowns apart where they grow (promo 03's hills), but never more than one cell per 1.1 km: at small@@ -186,7 +194,9 @@ namespace Statecraft.Game.Map.Kitsif (!rnd.Chance(Mathf.Max(p, 0.03f))) continue;var b = ground.Biome(px, pz);bool plain = b == "coastal_plain" || b == "lowland";- if (!plain && b != "hills" && b != "mountains" && b != "valley") continue;+ bool hill = b == "hills" || b == "mountains";+ float size = hill ? HillOliveSize : 1f;+ if (!plain && !hill && b != "valley") continue;if (plain && !rnd.Chance(0.35f)) continue; // lone trees between the fieldsfloat e = ground.ElevM(px, pz);if (e < (plain ? 5f : 40f) || e > 950f || ground.Water(px, pz) || ground.InTown(px, pz, 0.9f) || ground.Slope(px, pz, 600f) > 0.35f) continue;@@ -194,7 +204,10 @@ namespace Statecraft.Game.Map.Kitsfor (int i = 0; i < n; i++){float tx = px + rnd.Range(-0.5f, 0.5f) * cell, tz = pz + rnd.Range(-0.5f, 0.5f) * cell;- if (!ground.Water(tx, tz) && !ground.InTown(tx, tz, 0.85f)) Add(TreeKind.Olive, tx, tz, ref rnd);+ if (hill && !rnd.Chance(HillOliveShare)) continue;+ // Off the hex-edge midpoints, as the scatter below (the grid guard, L1's G4).+ if (ground.OnGridMark(new Vector2(tx, tz), CrownRadiusM(TreeKind.Olive) * s * size * 1.15f)) continue;+ if (!ground.Water(tx, tz) && !ground.InTown(tx, tz, 0.85f)) Add(TreeKind.Olive, tx, tz, ref rnd, size);}}}@@ -219,7 +232,8 @@ namespace Statecraft.Game.Map.Kitsfloat uneven = 0.4f + 1.2f * Mathf.PerlinNoise(px / 23000f + 3.7f, pz / 23000f + 1.9f);if (!rnd.Chance(ScatterShare * uneven)) continue;bool scrub = rnd.Chance(ScrubShare);- float size = scrub ? rnd.Range(0.5f, 0.7f) : rnd.Range(0.9f, 1.2f);+ float size = scrub ? rnd.Range(0.5f, 0.7f) : rnd.Range(0.9f, 1.2f) * HillOliveSize;+ if (!scrub && !rnd.Chance(HillOliveShare)) continue;float e = ground.ElevM(px, pz);if (e < 120f || e > 950f || !ground.HillCountry(px, pz) || ground.Water(px, pz) || ground.Slope(px, pz, 600f) > 0.37f) continue;var p = new Vector2(px, pz); float crown = CrownRadiusM(TreeKind.Olive) * s * size * 1.15f;diff --git a/unity/Assets/Tests/EditMode/KitTests.cs b/unity/Assets/Tests/EditMode/KitTests.csindex 712022c4b..ede1a3418 100644--- a/unity/Assets/Tests/EditMode/KitTests.cs+++ b/unity/Assets/Tests/EditMode/KitTests.cs@@ -977,10 +977,11 @@ public class KitTests/// <summary>Issue #34, vegetation round 2: promo 03's hills carry a loose scatter of single olives and low scrub between/// the olive clumps. Over the wet hill country (KitGround.HillCountry, 120-950 m) the map as built has at least- /// <see cref="HillCrownsPer100Km2"/> olive crowns per 100 km², about <see cref="Vegetation.ScrubShare"/> of the scatter- /// low scrub (a squat olive); no scrub crown reaches a town's or village's footprint or a grove's tree; and the scrub is- /// spread loosely, neither clumped nor in rows: the Clark-Evans ratio of its nearest-neighbour distances (1 for random- /// points, under 1 clumped, about 2 on a grid) stays within <see cref="ScrubSpread"/>.</summary>+ /// <see cref="HillCrownShare"/> of the ground under an olive crown (planar, before overlaps), about+ /// <see cref="Vegetation.ScrubShare"/> of the scatter low scrub (a squat olive); no scrub crown reaches a town's or+ /// village's footprint or a grove's tree; and the scrub is spread loosely, neither clumped nor in rows: the Clark-Evans+ /// ratio of its nearest-neighbour distances (1 for random points, under 1 clumped, about 2 on a grid) stays within+ /// <see cref="ScrubSpread"/>.</summary>[Test]public void TheHillsCarryALooseScatterOfOlivesAndScrub(){@@ -995,6 +996,8 @@ public class KitTestsvar scrubM = olives.Where(Squat).ToList();var scrub = scrubM.Select(m => new Vector2(m.m03, m.m23)).ToList();float per100 = olives.Count * 100f / hillKm2;+ // The share of the hill country under an olive crown, planar and before overlaps (Σ π r² over the area).+ float crownShare = olives.Sum(m => { float r = Vegetation.CrownRadiusM(TreeKind.Olive) * ((Vector3)m.GetColumn(0)).magnitude; return Mathf.PI * r * r; }) / (hillKm2 * 1e6f);// Nearest neighbours, footprints and grove trees through a 5 km grid.static Dictionary<(int, int), List<Vector2>> Grid(IEnumerable<Vector2> ps){@@ -1024,8 +1027,8 @@ public class KitTestsfloat groveCrownMax = groveTrees.Count == 0 ? 0f : groveTrees.Max(t => Crown(t.kind, t.m));int inGrove = scrubM.Count(m => { var p = new Vector2(m.m03, m.m23); return Near(groveGrid, p).Any(q => (q - p).magnitude < Crown(TreeKind.Olive, m) + groveCrownMax); });TestContext.WriteLine($"hill country {hillKm2} km²: {olives.Count} olives ({per100:0.0} per 100 km²), {scrub.Count} of them scrub; " +- $"scrub spread (Clark-Evans) {spread:0.00}; trees {veg.Count}; scrub reaching a footprint {inTown}, a grove tree {inGrove}");- Assert.GreaterOrEqual(per100, HillCrownsPer100Km2, "olive crowns over the hill country");+ $"crown area {crownShare:0.000} of the hill country; scrub spread (Clark-Evans) {spread:0.00}; trees {veg.Count}; scrub reaching a footprint {inTown}, a grove tree {inGrove}");+ Assert.GreaterOrEqual(crownShare, HillCrownShare, "olive crown area over the hill country");Assert.Greater(scrub.Count, 0.25f * olives.Count * Vegetation.ScrubShare, "low scrub among them");Assert.That(spread, Is.InRange(ScrubSpread.x, ScrubSpread.y), "the scrub is spread loosely, not clumped or in rows");Assert.AreEqual(0, inTown, "scrub reaching a town's or village's footprint");@@ -1033,10 +1036,121 @@ public class KitTests}/// <remarks>Measured 2026-10-14 over 11,285 km² of hill country: main 3,480 olives (30.8 per 100 km²), no scrub; with the- /// scatter 15,165 (134.4), 4,234 of them scrub, Clark-Evans 1.08.</remarks>- public const float HillCrownsPer100Km2 = 120f;+ /// scatter 15,165 (134.4), 4,234 of them scrub, Clark-Evans 1.08. Visual gap L1 (15 Oct 2026) makes the hill olives+ /// fewer and larger (Vegetation.HillOliveSize, HillOliveShare), so the floor is now on the crowns' area, not their count:+ /// main 8e45d8dc measured 15,167 olives (134.4 per 100 km²) under 0.292 of the hill country, and L1 10,405 (92.2) under+ /// 0.454 (16 Oct 2026). The floor is about 90% of L1's share, the headroom the old count floor had (120 against 134),+ /// so it fails on main's smaller crowns and on a loss of a tenth of L1's crown area.</remarks>+ public const float HillCrownShare = 0.41f;public static readonly Vector2 ScrubSpread = new Vector2(0.8f, 1.3f);+ /// <summary>Visual gap L1 (issue #34): promo 03's hill olives are large rounded crowns. At gameplay03 (top inset off; the+ /// crowns are projected geometry, not a render), every full-size hill olive (an olive on the hills or mountains that is+ /// not squat scrub) whose trunk falls in a window of the east hills has its crown's vertices projected; its on-screen+ /// diameter is their horizontal spread, as a share of the frame's width. The median in each window must fall in promo+ /// 03's band for that frame height.</summary>+ /// <remarks>The windows are the plan's OW1 and OW2 frame heights (top-down y 0.269-0.361 and 0.481-0.620) across the east+ /// hills (x 0.66-0.96). The bands come from 53 crowns hand-marked as circles on promo 03 (2752 px wide), 15 Oct 2026:+ /// PW2 (x 1880-2280, y 420-620, top-down frame y 0.27-0.40) 33 crowns, median 0.97% of the width (IQR 0.92-1.02); PW3+ /// (x 2110-2310, y 740-940, y 0.48-0.61) 20 crowns, median 1.21% (IQR 0.97-1.33). Each band is the median ±15%, cut to+ /// the plan's provisional band (1.0-1.2% and 1.2-1.45%), which the marks may narrow but not move. So the upper band+ /// (1.00-1.12%) sits above PW2's own median (0.97%) by design: the ±15% band (0.82-1.12%) is cut at the provisional+ /// 1.0% floor, and a crown at the promo's exact median would fail it.</remarks>+ public static readonly Vector2 PromoCrownUpper = new Vector2(0.0100f, 0.0112f), PromoCrownMiddle = new Vector2(0.0120f, 0.0139f);++ static readonly Rect EastHillsUpper = Rect.MinMaxRect(0.66f, 1f - 0.361f, 0.96f, 1f - 0.269f);+ static readonly Rect EastHillsMiddle = Rect.MinMaxRect(0.66f, 1f - 0.620f, 0.96f, 1f - 0.481f);++ static bool FullHillOlive(KitGround g, TreeKind k, Matrix4x4 m)+ {+ if (k != TreeKind.Olive || ((Vector3)m.GetColumn(1)).magnitude < 0.8f * ((Vector3)m.GetColumn(0)).magnitude) return false;+ var b = g.Biome(m.m03, m.m23);+ return b == "hills" || b == "mountains";+ }++ [UnityTest]+ public IEnumerator TheHillOlivesMatchPromo03sCrownSize()+ {+ var map = OpenMap();+ yield return null;+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();+ PromoPose.Gameplay03.Apply(rig, map.Frame); rig.TopInset = 0; rig.Apply();+ var g = Ground(map);+ var veg = map.GetComponentInChildren<VegetationLayer>(); Assert.IsNotNull(veg);+ var olive = Vegetation.Build(TreeKind.Olive); var all = new List<Vector3>();+ olive.Positions(0, olive.VertexCount, all);+ var crown = all.Where(v => v.y > 1.75f).ToList(); // above the trunk's top (Vegetation.Build)+ var rt = new RenderTexture(1920, 1080, 24); var old = cam.targetTexture;+ var upper = new List<float>(); var middle = new List<float>();+ try+ {+ cam.targetTexture = rt;+ Assert.AreEqual(16f / 9f, cam.aspect, 1e-3f, "the frame is 16:9");+ foreach (var (k, m) in veg.Planted())+ {+ if (!FullHillOlive(g, k, m)) continue;+ var at = cam.WorldToViewportPoint(m.GetColumn(3));+ if (at.z <= 0f) continue;+ var w = EastHillsUpper.Contains(at) ? upper : EastHillsMiddle.Contains(at) ? middle : null;+ if (w == null) continue;+ float lo = float.MaxValue, hi = float.MinValue;+ foreach (var v in crown) { float x = cam.WorldToViewportPoint(m.MultiplyPoint3x4(v)).x; lo = Mathf.Min(lo, x); hi = Mathf.Max(hi, x); }+ w.Add(hi - lo);+ }+ }+ finally { cam.targetTexture = old; rt.Release(); Object.DestroyImmediate(rt); }+ static float Median(List<float> l) { l.Sort(); return l.Count == 0 ? 0f : l.Count % 2 == 1 ? l[l.Count / 2] : 0.5f * (l[l.Count / 2 - 1] + l[l.Count / 2]); }+ float mu = Median(upper), mm = Median(middle);+ TestContext.WriteLine($"gameplay03 hill olive crowns: upper window {upper.Count} trees, median {mu:P2} of the width (promo {PromoCrownUpper.x:P2}-{PromoCrownUpper.y:P2}); " ++ $"middle window {middle.Count} trees, median {mm:P2} (promo {PromoCrownMiddle.x:P2}-{PromoCrownMiddle.y:P2})");+ Assert.GreaterOrEqual(upper.Count, 15, "enough hill olives in the upper window"); Assert.GreaterOrEqual(middle.Count, 15, "enough in the middle window");+ Assert.That(mu, Is.InRange(PromoCrownUpper.x, PromoCrownUpper.y), "upper window: hill olive crown size against promo 03");+ Assert.That(mm, Is.InRange(PromoCrownMiddle.x, PromoCrownMiddle.y), "middle window: hill olive crown size against promo 03");+ }++ /// <summary>Visual gap L1 (issue #34): the hill olives cover about as much of the hills as promo 03's do. At gameplay03+ /// (tilt-shift and top inset off), the share of pixels in the plan's windows OW1 and OW2 whose luma changes by more+ /// than 3/255 when the trees are switched off. With shadows off this is the crowns alone, gated against promo 03's+ /// hand-marked crown cover; with shadows on (crowns and their shadows) it is reported.</summary>+ /// <remarks>Promo 03's crown cover, the union of the hand-marked circles (TheHillOlivesMatchPromo03sCrownSize): PW2+ /// 0.234, PW3 0.412, mean 0.323; the cover here is likewise the mean of OW1's and OW2's shares. The band is 0.323 ±15%.+ /// OW1 is x 1530-1730, y 290-390 and OW2 x 1540-1740, y 520-670 (top-down) of 1920 x 1080, fixed by the plan.</remarks>+ public static readonly Vector2 PromoCrownCover = new Vector2(0.275f, 0.371f);++ [UnityTest]+ public IEnumerator TheHillOlivesCoverPromo03sShareOfTheHills()+ {+ var map = OpenMap();+ yield return null;+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();+ PromoPose.Gameplay03.Apply(rig, map.Frame); rig.TopInset = 0; rig.Apply();+ RenderSample.TiltShift(false);+ var windows = new[] { new RectInt(1530, 290, 200, 100), new RectInt(1540, 520, 200, 150) };+ (float cover, int[] each) Cover(bool shadows)+ {+ VisualToggles.Set("shadows", shadows);+ VisualToggles.Set("trees", true); var on = RenderSample.Render(cam, 1920, 1080);+ VisualToggles.Set("trees", false); var off = RenderSample.Render(cam, 1920, 1080);+ VisualToggles.Set("trees", true); VisualToggles.Set("shadows", true);+ var each = new int[windows.Length];+ for (int i = 0; i < windows.Length; i++)+ {+ var w = windows[i];+ for (int y = w.yMin; y < w.yMax; y++)+ for (int x = w.xMin; x < w.xMax; x++)+ {+ int row = 1079 - y; // RenderSample's row 0 is the bottom+ if (Mathf.Abs(RenderSample.Luma(on.At(x, row)) - RenderSample.Luma(off.At(x, row))) > 3f / 255f) each[i]++;+ }+ }+ return (0.5f * (each[0] / 20000f + each[1] / 30000f), each);+ }+ var crowns = Cover(false); var withShadows = Cover(true);+ TestContext.WriteLine($"gameplay03 OW1+OW2 cover: crowns {crowns.cover:0.000} (OW1 {crowns.each[0] / 20000f:0.000}, OW2 {crowns.each[1] / 30000f:0.000}; promo {PromoCrownCover.x:0.00}-{PromoCrownCover.y:0.00}), " ++ $"crowns and shadows {withShadows.cover:0.000} (OW1 {withShadows.each[0] / 20000f:0.000}, OW2 {withShadows.each[1] / 30000f:0.000})");+ Assert.That(crowns.cover, Is.InRange(PromoCrownCover.x, PromoCrownCover.y), "hill olive crown cover against promo 03");+ }+/// <summary>The WebGL checkpoint drew every palm black: a frond's tip quad collapsed to a point, its edge-based normal was/// zero and normalize(0) is NaN on WebGL 2 (the tilt-shift then smeared it into black blocks). No part may have one.</summary>[Test]@@ -1090,6 +1204,21 @@ public class KitTests/// midpoints (KitGround.OnGridMark, 2026-10-12).</remarks>public const float GridReadableShare = 0.75f;+ /// <summary>Visual gap L1's grid guard (G4; owner, 15 Oct 2026: "Yes, add the guard now"): no olive's crown, clump or+ /// scatter, reaches the midpoint of an edge of its hex (KitGround.OnGridMark), as the 1948 villages' houses and the+ /// camps' tents already keep off them, so the larger hill crowns never bury the grid where it is easiest to see.</summary>+ [Test]+ public void NoOliveCrownCoversAHexEdgeMidpoint()+ {+ var map = OpenMap();+ var g = Ground(map);+ var olives = Vegetation.Plant(map.Settlements, g).Where(t => t.kind == TreeKind.Olive).ToList();+ int onMark = olives.Count(t => g.OnGridMark(new Vector2(t.m.m03, t.m.m23), Vegetation.CrownRadiusM(TreeKind.Olive) * ((Vector3)t.m.GetColumn(0)).magnitude));+ TestContext.WriteLine($"{olives.Count} olives, {onMark} with a crown over a hex-edge midpoint");+ Assert.Greater(olives.Count, 1000);+ Assert.AreEqual(0, onMark, "olive crowns over a hex-edge midpoint");+ }+[UnityTest]public IEnumerator TheGridStaysReadableThroughTownsAndGroves(){