A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map: Nahalal is laid out as Kauffmann's moshav ring, a public building at the hub and the farmsteads along the ring street (refs #32) (#851)
Beri17fd5b10272a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 17236b20e..c6881feae 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -43,6 +43,10 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBThe #519 grade is unchanged.- The overview's sea is a deeper blue, toward promo 02 (refs #709, #695, #388): the water haze, seen only beyond 120 km,is bluer (`MapShaderGlobals.WaterHazeColour`), so the gameplay zoom's sea does not change. The #519 grade is unchanged.+- Nahalal, the map's moshav, is laid out as Kauffmann's ring (refs #32): a public building at the hub, across from the water+ tower (plastered, a red tiled gable, longer than a farmstead), and its farmsteads turned with the long side along the+ ring street instead of square to one grid. The basis is en.wiki "Nahalal": "the public buildings ... in the centre",+ "then a ring street with the farmers' homesteads bordering on it on the outside". No other place moves.- A kibbutz no longer looks like a moshav or a moshava (refs #32). The five kibbutz game settlements and the kibbutz rowsof the 1948 localities get a dining hall near the heart, opposite the water tower (white, flat roof, a raisedclerestory), long one-storey members' houses under red tiles, and grey-roofed farm sheds on one side, the farm yard.diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.csindex 52eb17eb7..94f32d06c 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs@@ -32,7 +32,8 @@ namespace Statecraft.Game.Map.Kitscase Archetype.ArabTown: return Mosque(s.Id, heart, ground, km, lots, ref rnd, 1f);case Archetype.Moshava:return WaterTower(s.Id, heart + new Vector2(R * 0.35f, -R * 0.2f), ground, km, lots)- + (s.Type == "kibbutz" ? DiningHall(s.Id, heart, R, ground, km, lots) : 0); // #32+ + (s.Type == "kibbutz" ? DiningHall(s.Id, heart, R, ground, km, lots) : 0) // #32+ + (s.Type == "moshav" ? PublicBuilding(s.Id, heart, R, ground, km, lots) : 0); // #32default: return 0;}}diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.csnew file mode 100644index 000000000..91533621e--- /dev/null+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs@@ -0,0 +1,44 @@+#nullable enable+using UnityEngine;++namespace Statecraft.Game.Map.Kits+{+ /// <summary>The moshav kit (issue #32): Nahalal, the map's one moshav, already stands on a ring (<see cref="Allows"/>); this+ /// gives the ring its plan. The basis is Richard Kauffmann's 1921 layout as the English Wikipedia's "Nahalal" gives it+ /// (https://en.wikipedia.org/wiki/Nahalal, checked 2026-10-17): "the public buildings (school, administration offices,+ /// services, and warehouses) in the centre", "then a ring street with the farmers' homesteads bordering on it on the+ /// outside"; the Hebrew article agrees ("ובחלק הפנימי של המעגל נבנו מוסדות הציבור", https://he.wikipedia.org/wiki/נהלל).+ /// So the hub gets a public building, near the heart across from the water tower, and each farmstead is turned with its long side along the+ /// ring. The building's size and colours are modelling choices.</summary>+ public static partial class SettlementKits+ {+ /// <summary>The public building's footprint (real m, at the house scale) and wall height in storeys: longer than a+ /// farmstead (a school's row of classrooms), one storey with a high room.</summary>+ const float MoshavHallW = 10.5f, MoshavHallD = 6f, MoshavHallStoreys = 1.3f;++ /// <summary>The yaw (degrees) that sets a building's long side (its own x) along the ring through+ /// <paramref name="offset"/> from the hub: at right angles to the line from the hub.</summary>+ static float RingYaw(Vector2 offset) => Mathf.Atan2(offset.y, offset.x) * Mathf.Rad2Deg + 90f;++ /// <summary>A moshav's public building (a landmark, placed after the water tower and before any house): plastered walls under+ /// a red tiled gable, on a free spot near one of the dining hall's spots round <paramref name="heart"/> (radius+ /// <paramref name="R"/>; they keep clear of the water tower), long side along the ring; or none. Returns how many were+ /// built (0 or 1).</summary>+ static int PublicBuilding(string owner, Vector2 heart, float R, KitGround ground, KitMesh km, Lots lots)+ {+ float m = KitScale.Houses, w = m * MoshavHallW, d = m * MoshavHallD, h = MoshavHallStoreys * 3.3f * m;+ // One ring of the search only, as the dining hall's: pushed to the edge it would no longer be the hub.+ var p = Vector2.zero; bool found = false;+ foreach (var at in KibbutzHallAt)+ if (found = Claim(lots, heart + at * R, 0.5f * Mathf.Sqrt(w * w + d * d), owner, ground, out p, rings: 1)) break;+ if (!found) return 0;+ float yaw = RingYaw(p - heart);+ var (bottom, top) = GroundSpan(p, yaw, w, d, ground, m);+ var wall = C(0.91f, 0.86f, 0.75f); var roof = C(0.70f, 0.30f, 0.20f);+ km.Box(p.x, p.y, yaw, w, d, bottom, top, h, wall, roof, Facade.Village, m, roofed: true);+ km.Gable(p.x, p.y, yaw, w, d, top + h, d * 0.42f, roof, wall);+ Record(owner, "public_building", p, yaw, w, d, h, wall);+ return 1;+ }+ }+}diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs.meta b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs.metanew file mode 100644index 000000000..5ed77d5db--- /dev/null+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 4a51838441a81be8586809451c3362b2\ No newline at end of filediff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.csindex 0782f95d3..5d0e980b9 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.cs@@ -552,6 +552,14 @@ namespace Statecraft.Game.Map.Kits// The cheap tests first (the boot budget): the cell and the quarter, then the terrain samples.if (!ground.Inside(p.x, p.y) || !Mine(p) || !Allows(s, L, p, t, ground) || ground.Water(p.x, p.y)) continue;if (!Fit(L, p, yaw, t, spec, L.Group, out var b, out var q)) continue;+ // A moshav (#32): the farmstead turns its long side along the ring street (its jitter kept). The lot is a+ // circle, so only the footprint's water and beach tests (they turn with the yaw) run again.+ if (s.Type == "moshav")+ {+ yaw += RingYaw(q - centre) - L.Yaw;+ if (CornerInWater(q, yaw, b.w, b.d, ground)) continue;+ if (shore && NearSea(q, yaw, b.w + 2f * BeachSetbackM, b.d + 2f * BeachSetbackM, ground)) continue;+ }lots.Add(new Lot { c = q, r = b.lotR, id = s.Id, group = L.Group });var drnd = new KitRandom(detail);Emit(s.Id, L.Style, q, yaw, b, t, ground, km, ref drnd);@@ -616,6 +624,9 @@ namespace Statecraft.Game.Map.Kitsvar b = Pick(arch, r / R, ref srnd, m, s.Type == "kibbutz");b.lotR = 0.5f * Mathf.Sqrt(b.w * b.w + b.d * b.d); // the whole footprint, as a plot's (round 1's lot let a corner reach a road)float yaw = arch == Archetype.Moshava || arch == Archetype.WhiteCity ? GridYaw(s.Id) + srnd.Range(-4f, 4f) : srnd.Range(0f, 90f);+ // A moshav (#32): along the ring street, as its lattice's farmsteads (Nahalal's lattice places fewer than+ // SmallTownFloor, so its fallback runs; MoshavKitTests checks every house it places).+ if (s.Type == "moshav") yaw += RingYaw(new Vector2(Mathf.Cos(ang), Mathf.Sin(ang))) - GridYaw(s.Id);spots.Add((r, i, centre + new Vector2(Mathf.Cos(ang), Mathf.Sin(ang)) * r, yaw, b, srnd.Next()));}spots.Sort((x, y) => x.r != y.r ? x.r.CompareTo(y.r) : x.i.CompareTo(y.i));diff --git a/unity/Assets/Tests/EditMode/MoshavKitTests.cs b/unity/Assets/Tests/EditMode/MoshavKitTests.csnew file mode 100644index 000000000..a4d3d8785--- /dev/null+++ b/unity/Assets/Tests/EditMode/MoshavKitTests.cs@@ -0,0 +1,74 @@+#nullable enable+using System.Collections.Generic;+using System.Linq;+using NUnit.Framework;+using Statecraft.Game.Map;+using Statecraft.Game.Map.Kits;+using UnityEditor.SceneManagement;+using UnityEngine;++/// <summary>The moshav kit (#32, SettlementKits.Moshav.cs): Nahalal, the map's moshav, is laid out as Kauffmann's ring, the+/// public building at the hub and the farmsteads turned to face the ring street.</summary>+public class MoshavKitTests+{+ [TearDown]+ public void Restore()+ {+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);+ VisualToggles.Clear();+ KitScale.Reset();+ }++ static MapScene OpenMap()+ {+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ var map = Object.FindFirstObjectByType<MapScene>(); map.Build();+ return map;+ }++ /// <summary>Nahalal has one public building, near its hub (within 0.65 of the radius); no other game settlement has one.</summary>+ [Test]+ public void TheMoshavHasOnePublicBuildingAtItsHub()+ {+ var map = OpenMap();+ TownCensusTests.Census(map, out var placed, out var g);+ var bad = new List<string>();+ int moshavim = 0;+ foreach (var s in map.Settlements)+ {+ var halls = placed.Where(p => p.Id == s.Id && p.Kind == "public_building").ToList();+ if (s.Type != "moshav") { if (halls.Count > 0) bad.Add($"{s.Id} ({s.Type}): {halls.Count} public buildings"); continue; }+ moshavim++;+ if (halls.Count != 1) { bad.Add($"{s.Id}: {halls.Count} public buildings"); continue; }+ var w = map.Frame.ToWorld(s.Lon, s.Lat, 0);+ float t = (halls[0].C - new Vector2(w.x, w.z)).magnitude / SettlementKits.FootprintRadiusM(s, g.HexSizeM);+ TestContext.WriteLine($"{s.Id}: public building at t={t:0.00}");+ if (t > 0.65f) bad.Add($"{s.Id}: the public building stands at {t:0.00} of the radius");+ }+ Assert.AreEqual(1, moshavim, "Nahalal, the one moshav game settlement");+ CollectionAssert.IsEmpty(bad);+ }++ /// <summary>Every Nahalal house stands with its long side along the ring (its own x axis at right angles to the line from+ /// the hub, give or take the 4 degree yaw jitter: |cos| at most sin 4 degrees, 0.070), and there are at least three of them.</summary>+ [Test]+ public void TheFarmsteadsFaceTheRingStreet()+ {+ var map = OpenMap();+ TownCensusTests.Census(map, out var placed, out _);+ var s = map.Settlements.Single(x => x.Type == "moshav");+ var w = map.Frame.ToWorld(s.Lon, s.Lat, 0);+ var centre = new Vector2(w.x, w.z);+ var houses = placed.Where(p => p.Id == s.Id && p.Kind == "building").ToList();+ var bad = new List<string>();+ foreach (var h in houses)+ {+ float a = h.Yaw * Mathf.Deg2Rad;+ float dot = Mathf.Abs(Vector2.Dot(new Vector2(Mathf.Cos(a), Mathf.Sin(a)), (h.C - centre).normalized));+ TestContext.WriteLine($"{s.Id}: house at {h.C}, |cos| to the radial {dot:0.000}");+ if (dot > 0.08f) bad.Add($"house at {h.C}: its long side is {Mathf.Acos(dot) * Mathf.Rad2Deg:0} degrees off the radial, not across it");+ }+ Assert.GreaterOrEqual(houses.Count, 3, "Nahalal's farmsteads");+ CollectionAssert.IsEmpty(bad);+ }+}diff --git a/unity/Assets/Tests/EditMode/MoshavKitTests.cs.meta b/unity/Assets/Tests/EditMode/MoshavKitTests.cs.metanew file mode 100644index 000000000..25c52c0ff--- /dev/null+++ b/unity/Assets/Tests/EditMode/MoshavKitTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 4d342b9eb0848c7d2afed8907260bc44\ No newline at end of file