A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map: the 1948 Arab villages as dense, terraced packs of small stone houses; village mosques without domes (refs #32) (#647)
Eyal Golan98515c527027
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 30d218b47..29d5f2996 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -349,6 +349,12 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB+0.9 ms at the gameplay zoom), not yet on an idle one.### Changed+- The 1948 Arab villages and towns on the map are dense packs of small stone houses with lanes between them (visual+ gap S1, refs #32): each Arab locality is laid out on the village plot lattice, as Lod and Ramla are, with smaller+ one-room houses (3.8-5.4 m, still at 100x), more two-storey houses in the core, roof rooms, and terraces under the+ hill houses that stand on a slope. A village keeps its mosque, now a one-storey hall with a short square minaret; the+ domed mosque with its tall minaret stays with the Arab towns. The median Arab locality draws 11 houses (main 5), in+ the same merged tile meshes (64 draws). Presentation only (`docs/visual-v1.md`, "Arab villages: dense, terraced cores").- 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/docs/visual-v1.md b/docs/visual-v1.mdindex 6ad03e5a3..7ba61e41d 100644--- a/docs/visual-v1.md+++ b/docs/visual-v1.md@@ -2485,6 +2485,121 @@ the biggest gap to promo 03. Measured with its crops and poses: editor renders (Techniques in Palestine", Prostor 25 (2017) 140-153, https://doi.org/10.31522/p.25.1(53).9- The White City (1930s International Style, flat roofs, balconies): https://en.wikipedia.org/wiki/White_City,_Tel_Aviv+## Arab villages: dense, terraced cores (visual gap S1, branch `visual/arab-villages-s1`, refs #32)+The 2026-10-15 gap audit ranked this 9 of 10: promo 03's Qalqilya, Lydda and Ramla are dense packs of layered stone+houses, while main drew each 1948 Arab locality as a handful of large cubes with a domed mosque at its heart, so the+hills read as evenly spaced dice, nearly every one with a dome.++**Cause on main `c02d4eb0`.**+- The 250 Arab localities (type `village` or `arab_town`, mixed Nesher aside) took the promo-villages scatter+ (`BuildOne`). They are 234 Muslim (216 villages and 18 Arab towns), 11 Christian (a church) and 5 Druze (no+ landmark). Each wanted six buildings (`TargetCount`'s floor: at 100x the built-up share asks for fewer), each 6.5-12 m+ real, so 650-1,200 m wide, on random spots. Counted from their lots: 1,063 houses, median 5, and 17 with none.+- Every Muslim locality built the domed town mosque at 0.8 size (a 672 m hall, a 264 m dome and a 1.25 km round minaret).++**Changes** (`SettlementKits.cs`, `SettlementKits.Landmarks.cs`):+- **Layout.** An Arab locality is laid out on the village plot lattice (`PlaceHouses`, towns round 2), as Lod and Ramla+ are, nearest its heart first. As before, it builds only in its own cell, off the routes, the grid's edge midpoints+ (review M10) and every other place's lots. It keeps no beach setback: the coast's villages met the shore, as their+ scatter drew them. Where the routes, a bigger neighbour or the cell's seam leave fewer than ten houses+ (`VillageFloor`), small village houses fill free spots over its plot reach, nearest the heart first.+- **The village lattice** (`Style.Village`, so also Lod, Ramla, Tiberias, Safed and Jerusalem's Arab quarters):+ - The pitch is 6.6 x 6.2 m (was 7.6 x 7.2) with less jitter. Houses are 3.8-5.4 x 3.6-5.0 m (was 4.4-6.6 x 4.2-6.0),+ so the lanes run about two metres real.+ - It is built solid to 0.75 of the radius (was 0.5), and 0.85 at the radius (was 0.6).+ - More two-storey houses in the core: 60% falling to 15% (was 45% to 10%). Single-storey houses keep their roof+ rooms, and the roofs stay flat lime plaster.+ - House domes on hill houses fall from 7% to 3%. A village now draws about twice the houses, so it keeps about the+ domes it had.+- **Terraces.** A hill house (above 120 m) whose ground falls more than 0.8 m across its footprint, beyond its 2 m+ plinth, stands on a terrace. The terrace is a dry-stone retaining wall up to the house's uphill ground, with a yard+ 0.3 m wide round the walls. The house's lot covers the terrace.+- **The mosque rule.** Every Muslim locality keeps its mosque: all 271 localities are places of 1,000 or more people,+ none a hamlet. A village's mosque is now a village mosque (`VillageMosque`):+ - a one-storey stone hall, 12 x 9 m at the landmark scale (0.8 x 60x: 576 x 432 m);+ - a flat lime roof and no dome;+ - a short, thick square minaret at one corner, about 14 m tall (672 m), inside the hall's footprint.++ The domed mosque with its tall round minaret stays with the 18 Muslim Arab towns (Hebron, Nablus, Majdal, Qalqilya+ and the others), and with the game towns, which keep their own landmarks. So the domed mosques at the localities go+ from 234 to 18. House domes stay: 3% of hill houses, about main's count per village (see above).+- **The game towns keep their ground.** A village keeps its houses out of every smaller game settlement's plot reach,+ plus the lot of that settlement's largest fallback house. That settlement places its houses, and its small-town+ fallback (#317), after the village. Without this rule, Hiribya's packed lattice left Yad Mordechai 1 house against+ its measured floor of 3.++**Historical basis** (sources below):+- Village houses were single rooms, ranging "from three meters in small houses" to more than ten in big ones, clustered+ round yards "in a compact and convergent manner" (Abuarkub 2018). The kit takes the small end (3.8-5.4 m), so a+ village at 100x holds more houses. A caution: IJCIET's publisher, IAEME, is widely listed as a predatory publisher.+ The quoted phrases are in the paper and only a visual parameter rests on them, but a stronger reference (such as+ Amiry and Tamari, *The Palestinian Village Home*, 1989) has not been checked yet.+- Hill villages such as Battir stood among stone field terraces round the village. The terrace under a sloped house is a+ modelling choice that carries that stepped look into the village itself, not a sourced house form.+- A village mosque was a one-storey hall with a chunky minaret at one end (Qaysaria), and a village's square minaret+ stood 10-15 m (Kawfakha, from Petersen's gazetteer).+- No source here supports leaving out the mosques of the villages of 1,000 or more people. So the rule makes them+ smaller and domeless; it does not drop them.++**Result** (EditMode census: `VillageKitTests`, `TownCensusTests`; main from the localities' lots on the same build):++| | main `c02d4eb0` | branch |+|---|---|---|+| Arab localities' houses (250, churches and Druze villages included) | 1,063, median 5 | 2,617, median 11 (`VILLAGES`: max 50) |+| localities with no house | 17 | 9, all inside Jerusalem's or Tel Aviv's footprint (Silwan, At-Tur, Lifta, Abu Dis, Sheikh Muwannis...) |+| hill villages (150): median houses, core cover by houses | not recorded (main records no locality house) | 12, 17.5% |+| domed mosques at the localities / village mosques | 234 / 0 | 18 / 216 |+| Lod / Ramla houses (census) | 11 / 11 | 16 / 16 |+| WebGL `KITS` line: buildings, vertices, triangles, draws | 1,972, 103,537, 70,572, 64 | 3,632, 167,329, 89,178, 64 |+| grid readable at gameplay03 (floor 75%) | 79% (70 of 89) | 83% (74 of 89) |++- The villages under six houses outside the game towns are Yibna, Taibe, Bayt Dajan, al-Bireh (beside Ramallah),+ al-Jura, az-Zeeb, Wadi Hunayn, Tantura, Nazla and al-Jiyya (10 of about 200). The routes, the coast and bigger+ neighbours take their ground. The test holds the count at 5% or fewer.+- The core cover counts houses only (review of #647). Counted with the mosque, main's domed mosque alone covers 35.8% of+ the median hill core (49 of 137 samples), and the branch's houses and smaller mosque together also come to 35.8%. That+ match is a coincidence of the two medians, not a shared cause, and it is why the first version of the test passed on+ main. The test's floor is 15%, against the measured 17.5%. Main records no locality house, so on main the test reads+ 0%. That proves the test sees the houses; it does not show that main's large cubes covered less of the core.+- Each house stays at the house scale (100x): no village house is over 5.4 m real. The census and town tests pass,+ every town is at or over its floor, and Yad Mordechai is back to 3.+- The goldens are unchanged (`GOLDEN OK 1950 71e9904d`, `1952 62f8ec61`).+- **Against promo 03** (`p2-villages-s1-compare/`):+ - The villages now read as packs of small houses with lanes, not as dice, and the domed mosques are gone from the+ villages. House domes remain on 3% of hill houses.+ - The promo's Qalqilya still has more and taller houses: 30-40 houses of two or three storeys on terraced rings.+ At 100x a village's 1.3-1.4 km footprint holds about 19 plots, so 30+ houses would need a smaller house scale or a+ larger village footprint (an owner call).+ - The promo's warmer honey stone and its shading are the palette and `Kit.shader`, out of scope here.++**Frame time** (headless WebGL `?vprofile`, 1920x1080 at DPR 1, each slot under one `machine_lock.py --exclusive+--wait-unity`, two slots in opposite orders, load 2-4, 2026-10-15; builds of main `c02d4eb0` and this branch before its+rebase onto #557, which adds the ma'abara kit and no village):++| | gameplay03 all (p95) | gameplay03 all - none | diorama02 all (p95) | diorama02 all - none |+|---|---|---|---|---|+| main, slot 1 / 2 | 8.21 / 8.21 ms (10 / 10) | 0.15 / 1.26 ms | 15.92 / 16.29 ms (17 / 17) | 4.98 / 5.28 ms |+| branch, slot 1 / 2 | 8.23 / 8.23 ms (10 / 10) | 1.25 / 1.24 ms | 16.10 / 15.94 ms (17 / 17) | 4.98 / 5.18 ms |++- Frame time is equal within the runs' spread. Main's 0.15 ms in slot 1 is its noisy `none` row (spread 1.1 ms).+- The localities stay merged per 30 km tile, so the draws stay at 64. The triangles grow from 70,572 to 89,178.+- The kits' own cost, all - (-kits), is within noise on both: -0.32 / -0.09 ms on main and -0.05 / -0.11 ms on the branch+ at gameplay03.+- **Boot** (`headed.py boot --runs 3 --cpu 4`, in slot 2): map_build median 2147 ms on main against 2293 ms on the+ branch (+146 ms), and first_frame 7780 against 7906 ms. The map build stays 427 ms under the 2720 ms budget.+ - The cost is the kit build: the player's `KITS build_ms` is 45 ms on main and 77 ms on the branch at cpu 1.+ - Most of it is the village lattice's plots and their fits, and the floor's spots for the villages under ten houses.+ - One round only. A tighter kit phase (fewer floor spots) is the lever if #321 needs the headroom.++### Sources (checked 2026-10-15)+- One-room village houses ("from three meters in small houses"), clustered round yards: M. Abuarkub, "Classifications and+ Revitalization of Traditional Houses in the Rural Areas in Palestine", IJCIET 9(12) (2018) 1141-1161,+ http://iaeme.com/MasterAdmin/Journal_uploads/IJCIET/VOLUME_9_ISSUE_12/IJCIET_09_12_118.pdf+- Battir, on a valley slope, its historical core surrounded by agricultural terraces: https://en.wikipedia.org/wiki/Battir+- A village minaret "chunky as it rises above the one-story mosque" (Qaysaria): L. Dittmar, "A View from the Minaret",+ Harvard Divinity Bulletin (2019), https://bulletin.hds.harvard.edu/a-view-from-the-minaret/+- Kawfakha's mosque, a "thick square minaret 10-15 meters high" (Petersen 2001, pp. 195-196): https://en.wikipedia.org/wiki/Kawfakha+## Issue #195: the water and the border lookups out of the terrain's fragment shader- **Why.** promo-sea (#138) put the water shading (`ScWaterShade`, the breakers' `fwidth`, the footprint) in the terraingraph's function, and promo-borders (#206) six neighbour fetches in `ScBorderApply`'s loop. Either one makes the shaderdiff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.csindex ff9c75c36..a877a40eb 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Landmarks.cs@@ -443,6 +443,29 @@ namespace Statecraft.Game.Map.Kitsreturn 1;}+ /// <summary>A village mosque (S1): a one-storey stone hall with a flat lime roof and a short, thick square minaret at one+ /// corner, about 14 m tall, inside the hall's footprint, so the lot is the hall's. Village minarets were "chunky" towers+ /// rising over a one-storey mosque (L. Dittmar, "A View from the Minaret", Harvard Divinity Bulletin, 2019, on+ /// Qaysaria; https://bulletin.hds.harvard.edu/a-view-from-the-minaret/), and a village's square minaret stood 10-15 m+ /// (Kawfakha, from Petersen's Gazetteer of Buildings in Muslim Palestine: https://en.wikipedia.org/wiki/Kawfakha;+ /// both checked 2026-10-15). The domed mosque with its tall round minaret (<see cref="Mosque"/>) stays the towns'.</summary>+ static int VillageMosque(string owner, Vector2 want, KitGround ground, KitMesh km, Lots lots, ref KitRandom rnd, float size)+ {+ float m = KitScale.Landmarks * size, w = 12f * m, d = 9f * m;+ if (!Claim(lots, want, 0.5f * Mathf.Sqrt(w * w + d * d), owner, ground, out var p)) return 0;+ float yaw = rnd.Range(0f, 90f);+ var (bottom, top) = GroundSpan(p, yaw, w, d, ground, m);+ var stone = Jitter(C(0.84f, 0.77f, 0.63f), ref rnd, 0.04f);+ var roof = Jitter(LimeRoof, ref rnd, 0.03f);+ km.Box(p.x, p.y, yaw, w, d, bottom, top, 5.5f * m, stone, roof, Facade.Stone, m);+ float a = yaw * Mathf.Deg2Rad, u = 0.5f * w - 1.4f * m, v = -(0.5f * d - 1.4f * m);+ float mx = p.x + u * Mathf.Cos(a) - v * Mathf.Sin(a), mz = p.y + u * Mathf.Sin(a) + v * Mathf.Cos(a);+ km.Box(mx, mz, yaw, 2.8f * m, 2.8f * m, top + 5.5f * m - 0.3f * m, top + 5.5f * m, 7.9f * m, stone, roof, Facade.Plain, m);+ km.Box(mx, mz, yaw, 3.3f * m, 3.3f * m, top + 13.4f * m - 0.2f * m, top + 13.4f * m, 0.6f * m, stone, roof, Facade.Plain, m); // the balcony's parapet+ Record(owner, "village_mosque", p, yaw, w, d, 14f * m, stone);+ return 1;+ }+/// <summary>A stone church with a gabled nave and a belfry topped by a pyramid roof; false, and nothing built, when no/// free dry spot is near.</summary>static bool Church(string owner, Vector2 want, KitGround ground, KitMesh km, Lots lots, float size)diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.csindex 728a731e6..ee8aebb65 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.cs@@ -160,6 +160,22 @@ namespace Statecraft.Game.Map.Kitselse result.TownLandmarks[s.Id] = n;landmarks[s.Id] = n; streams[s.Id] = rnd;}+ // A village's houses keep out of every smaller game settlement's plot reach, plus the lot of its largest+ // fallback house (S1): that settlement places its houses, and its small-town fallback (#317), after the+ // village, and the 25 towns keep the ground they had (Yad Mordechai beside Hiribya).+ var townReach = new List<(Vector2 c, float r, int pop)>();+ foreach (var t in towns)+ townReach.Add((centres[t.Id], FootprintRadiusM(t, ground.HexSizeM) * PlotReach + 0.5f * Mathf.Sqrt(12f * 12f + 9f * 9f) * KitScale.For(ArchetypeOf(t)),+ KitPopulation.Of(t.Id)));+ System.Func<Vector2, bool> SmallerTowns(Settlement loc)+ {+ int pop = KitPopulation.Of(loc.Id);+ return q =>+ {+ foreach (var (c, r, tp) in townReach) if (tp < pop && (q - c).sqrMagnitude < r * r) return true;+ return false;+ };+ }// Then the houses, largest place first. A game settlement's houses ignore the localities' cells (their landmarks'// lots still stand): the 25 towns keep the ground they had before the villages came, and a village next to one// (Fajja by Petah Tikva) fills in around its houses.@@ -169,7 +185,11 @@ namespace Statecraft.Game.Map.Kitsif (merged.Contains(s.Id)){var tile = Tile(centres[s.Id]); int from = tile.VertexCount;- result.LocalityBuildings += BuildOne(s, centres[s.Id], ground, tile, lots, Phase.Houses, ref rnd, landmarks[s.Id], null);+ // An Arab village or town (S1): a dense pack of small stone houses on the village lattice, as Lod's and+ // Ramla's. The Jewish localities and mixed Nesher keep their scatter.+ result.LocalityBuildings += ArchetypeOf(s) == Archetype.ArabTown && !Localities.IsMixed(s.Id)+ ? PlaceHouses(s, centres[s.Id], ground, tile, lots, ref rnd, null, out _, locality: true, keepOut: SmallerTowns(s))+ : BuildOne(s, centres[s.Id], ground, tile, lots, Phase.Houses, ref rnd, landmarks[s.Id], null);spans[s.Id].Add((tile, from, tile.VertexCount));continue;}@@ -339,7 +359,10 @@ namespace Statecraft.Game.Map.KitsStyle.TownBlock => (20f, 16f, 0.03f, KitScale.CityBlocks, 1.00f, 0.30f, 0.80f),Style.StoneBlock => (23f, 17.5f, 0.03f, KitScale.CityBlocks, 0.97f, 0.50f, 0.60f),Style.OldHouse => (7.2f, 6.8f, 0.05f, KitScale.Houses, 1.00f, 0.60f, 0.75f),- Style.Village => (7.6f, 7.2f, 0.07f, KitScale.Houses, 1.00f, 0.50f, 0.60f),+ // S1: a compact pack of small houses, lanes of about two metres between them, built solid to three quarters of+ // the radius (houses "clustered around the yards ... in a compact and convergent manner": Abuarkub 2018). The pitch+ // leaves a lane when two full-size neighbours' jitter and yaw meet (TownCensusTests.NoTwoHousesOfATownOverlap).+ Style.Village => (6.6f, 6.2f, 0.04f, KitScale.Houses, 1.00f, 0.75f, 0.85f),_ => (11.5f, 9.8f, 0.04f, KitScale.Houses, 0.95f, 0.40f, 0.60f),};@@ -409,9 +432,12 @@ namespace Statecraft.Game.Map.Kits/// <summary>Places a town's houses on its lattices, nearest the centre first; returns how many. When the lattice/// places fewer than <see cref="SmallTownFloor"/>, <paramref name="scatter"/> is the town's fallback (#317), which- /// Build runs after every other place's houses; else null.</summary>+ /// Build runs after every other place's houses; else null. A 1948 <paramref name="locality"/> (an Arab village or+ /// town, S1) keeps its houses off the grid's edge midpoints, as its scatter did (review M10), and out of+ /// <paramref name="keepOut"/> (the smaller game settlements' ground), keeps no beach setback, and fills up to its own+ /// floor (<see cref="VillageFloor"/>) at once instead of the deferred fallback.</summary>static int PlaceHouses(Settlement s, Vector2 centre, KitGround ground, KitMesh km, Lots lots, ref KitRandom rnd, HashSet<string>? ignoreCellsOf,- out System.Func<int>? scatter)+ out System.Func<int>? scatter, bool locality = false, System.Func<Vector2, bool>? keepOut = null){var arch = ArchetypeOf(s);float R = FootprintRadiusM(s, ground.HexSizeM), reach = R * PlotReach;@@ -435,7 +461,8 @@ namespace Statecraft.Game.Map.Kits}// Only a town with water near its footprint tests the beach setback per plot (eight samples each: the boot budget).- bool shore = WaterWithin(centre, reach + BeachSetbackM + 1000f, ground);+ // A 1948 village keeps none: the coast's villages (Tantura, az-Zeeb) met the shore, as their scatter drew them.+ bool shore = !locality && WaterWithin(centre, reach + BeachSetbackM + 1000f, ground);var plots = new List<(float d, int order, Vector2 p, int lattice)>();for (int li = 0; li < lattices.Count; li++){@@ -470,6 +497,7 @@ namespace Statecraft.Game.Map.Kitsq = p + new Vector2(u * ca - v * sa, u * sa + v * ca);if ((du != 0f || dv != 0f) && (!ground.Inside(q.x, q.y) || !Mine(q) || !Allows(s, L, q, t, ground) || ground.Water(q.x, q.y))) continue;if (!lots.Free(q, b.lotR, s.Id, group) || ground.OnRoute(q, b.lotR)) continue; // off the railways and roads too+ if (locality && (ground.OnGridMark(q, b.lotR) || (keepOut != null && keepOut(q)))) continue;if (ground.Slope(q.x, q.y, b.w) > (hillTown ? 0.6f : 0.35f)) continue;if (CornerInWater(q, yaw, b.w, b.d, ground)) continue; // the whole footprint is dryif (shore && L.Style != Style.OldHouse && NearSea(q, yaw, b.w + 2f * BeachSetbackM, b.d + 2f * BeachSetbackM, ground)) continue;@@ -503,6 +531,36 @@ namespace Statecraft.Game.Map.Kitsplaced++;}+ // A 1948 village's floor (S1): where the routes, a bigger neighbour's lots or the cell's seam take most of its+ // plots, small village houses on free spots over its plot reach, nearest its heart first (KitRandom(id, 3)), at+ // full size and then 0.72, until it has VillageFloor houses.+ if (locality && placed < VillageFloor)+ {+ var srnd = new KitRandom(s.Id, 3);+ float m = KitScale.Houses;+ var spots = new List<(float r, int i, Vector2 p, float yaw, Spec b, ulong detail)>();+ for (int i = 0; i < ScatterTries; i++)+ {+ float r = reach * Mathf.Sqrt(srnd.Value()), ang = srnd.Range(0f, 2f * Mathf.PI);+ var b = Pick(Style.Village, r / R, ref srnd, m);+ spots.Add((r, i, centre + new Vector2(Mathf.Cos(ang), Mathf.Sin(ang)) * r, lattices[0].Yaw + srnd.Range(-4f, 4f), b, srnd.Next()));+ }+ spots.Sort((x, y) => x.r != y.r ? x.r.CompareTo(y.r) : x.i.CompareTo(y.i));+ foreach (var shrink in new[] { 1f, 0.72f })+ for (int k = 0; k < spots.Count && placed < VillageFloor; k++)+ {+ var (r, _, p, yaw, full, detail) = spots[k];+ var b = Shrink(full, shrink);+ if (!ground.Inside(p.x, p.y) || !Mine(p) || ground.Water(p.x, p.y)) continue;+ if (!lots.Free(p, b.lotR) || ground.OnRoute(p, b.lotR) || ground.OnGridMark(p, b.lotR) || (keepOut != null && keepOut(p))) continue;+ if (ground.Slope(p.x, p.y, b.w) > 0.6f || CornerInWater(p, yaw, b.w, b.d, ground)) continue;+ lots.Add(new Lot { c = p, r = b.lotR, id = s.Id });+ var drnd = new KitRandom(detail);+ Emit(s.Id, Style.Village, p, yaw, b, r / R, ground, km, ref drnd);+ placed++;+ }+ }+// A small town's floor (#317): at the houses' 100x scale a plot is about 1 km, so a footprint of 1.3-2 km radius// holds only some 7 plots, and the routes, the sea or a neighbour's lots can take most of them.// Below SmallTownFloor houses the town is filled up as round 1 drew it: its archetype's full-size building (the@@ -510,7 +568,7 @@ namespace Statecraft.Game.Map.Kits// stream (KitRandom(id, 3)). Build runs it after every place's own houses and the camps, so it takes only ground// no other place builds on.scatter = null;- if (placed < SmallTownFloor && SmallTownScatter)+ if (placed < SmallTownFloor && SmallTownScatter && !locality){int want = SmallTownFloor - placed;scatter = () =>@@ -565,6 +623,8 @@ namespace Statecraft.Game.Map.Kits/// 25 towns' lattices fall short of it (the moshavot and kibbutzim, Tiberias, Netanya, Beersheba and Acre); their/// fallback houses join the lattice's where free ground is left (13 of them).</summary>const int SmallTownFloor = 6;+ /// <summary>The fewest houses a 1948 Arab village or town keeps (S1): the lattice's median village draws about a dozen.</summary>+ const int VillageFloor = 10;/// <summary>Random spots a small town's fallback tries before it settles for fewer than SmallTownFloor houses (round 1/// tried about 30 per building).</summary>const int ScatterTries = 240;@@ -662,8 +722,11 @@ namespace Statecraft.Game.Map.Kitsstoreys = Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(3.2f, 1.3f, Mathf.Clamp01(t)) + rnd.Range(-0.8f, 0.8f)), 1, 4);break;case Style.Village:- w = rnd.Range(4.4f, 6.6f); d = rnd.Range(4.2f, 6.0f);- storeys = rnd.Chance(Mathf.Lerp(0.45f, 0.1f, Mathf.Clamp01(t))) ? 2 : 1;+ // S1: the village's one-room house, smaller than a town's (the one-room house of the villages "ranges from+ // three meters in small houses" up: Abuarkub 2018; was 4.4-6.6 x 4.2-6.0 m).+ w = rnd.Range(3.8f, 5.4f); d = rnd.Range(3.6f, 5.0f);+ // More two-storey houses in the core (was 45% falling to 10%): the layered heart promo 03's Qalqilya shows.+ storeys = rnd.Chance(Mathf.Lerp(0.6f, 0.15f, Mathf.Clamp01(t))) ? 2 : 1;break;case Style.Templer:w = rnd.Range(8.5f, 10.5f); d = rnd.Range(7.5f, 9f);@@ -674,7 +737,9 @@ namespace Statecraft.Game.Map.Kitsstoreys = rnd.Chance(0.15f) ? 2 : 1;break;}- return new Spec { w = w * m, d = d * m, h = storeys * 3.3f * m, storeys = storeys, lotR = 0.5f * Mathf.Sqrt(w * w + d * d) * m };+ // A village house's lot also covers the terrace it may stand on (Emit, Style.Village).+ float pad = st == Style.Village ? 2f * TerraceMarginM : 0f;+ return new Spec { w = w * m, d = d * m, h = storeys * 3.3f * m, storeys = storeys, lotR = 0.5f * Mathf.Sqrt((w + pad) * (w + pad) + (d + pad) * (d + pad)) * m };}// sRGB palettes (promo 03: white and cream city, honey stone Jaffa, tan villages, terracotta roofs).@@ -773,7 +838,13 @@ namespace Statecraft.Game.Map.Kitsbool hill = ground.ElevM(p.x, p.y) >= HillVillageM;var wall = hill ? StoneWall(ref rnd) : Jitter(MudBrick, ref rnd, 0.06f);var roof = Jitter(LimeRoof, ref rnd, 0.05f);- StoneHouse(km, p, yaw, b, bottom, top, wall, roof, Facade.Village, m, hill && rnd.Chance(VillageDome), ref rnd);+ bool dome = hill && rnd.Chance(VillageDome);+ // S1: a hill house on a slope stands on its terrace, a dry-stone retaining wall up to the house's+ // uphill ground with a flat yard round the house, so a village on a hillside steps down in terraces.+ if (hill && top - bottom > TerraceRiseM * m)+ km.Box(p.x, p.y, yaw, b.w + 2f * TerraceMarginM * m, b.d + 2f * TerraceMarginM * m, bottom, top, 0.15f * m,+ Jitter(TerraceStone, ref rnd, 0.05f), Jitter(TerraceYard, ref rnd, 0.04f), Facade.Plain, m);+ StoneHouse(km, p, yaw, b, bottom, top, wall, roof, Facade.Village, m, dome, ref rnd);Record(id, "building", p, yaw, b.w, b.d, b.h, wall);break;}@@ -812,8 +883,17 @@ namespace Statecraft.Game.Map.Kitsconst float HillVillageM = 120f;/// <summary>Share of an old town's flat-roofed houses with a dome (was 22%: promo 03's Jaffa shows few).</summary>const float OldHouseDome = 0.08f;- /// <summary>Share of a hill village's houses with a dome (was 10% of every village's).</summary>- const float VillageDome = 0.07f;+ /// <summary>Share of a hill village's houses with a dome (was 10% of every village's, then 7%; S1: 3%, as a village now+ /// draws about twice the houses, so it keeps about the domes it had).</summary>+ const float VillageDome = 0.03f;+ /// <summary>A hill village's terraces (S1): a house whose ground falls more than this (real m, plinth included: 2 m)+ /// across its footprint stands on a terrace reaching this far (real m) past its walls. Hill villages such as Battir+ /// stood among stone field terraces ("on the precipitous slope of a deep valley", its core "surrounded by agricultural+ /// terraces": https://en.wikipedia.org/wiki/Battir, checked 2026-10-15); the terrace under a house is a modelling+ /// choice that carries that stepped look into the village.</summary>+ const float TerraceRiseM = 2.8f, TerraceMarginM = 0.3f;+ /// <summary>The terrace's dry-stone retaining wall and its beaten-earth yard (sRGB).</summary>+ static readonly Color32 TerraceStone = C(0.66f, 0.60f, 0.50f), TerraceYard = C(0.74f, 0.66f, 0.53f);/// <summary>Grey-buff limestone, lime-plastered roofs and the plain's mud brick (sRGB).</summary>static readonly Color32 LimeRoof = C(0.86f, 0.83f, 0.77f), MudBrick = C(0.78f, 0.69f, 0.56f);@@ -1002,7 +1082,11 @@ namespace Statecraft.Game.Map.Kitsfloat size = (s.Type == "village" ? 0.8f : 1f) * mosqueK;switch (Localities.LandmarkOf(s.Id) ?? Landmark.Mosque){- case Landmark.Mosque: return Mosque(s.Id, At(heart), ground, km, lots, ref rnd, size);+ // S1: a village keeps its mosque, as a village mosque (no dome, a short square minaret); the domed+ // mosque with its tall minaret is the Arab towns'.+ case Landmark.Mosque:+ return s.Type == "village" ? VillageMosque(s.Id, At(heart), ground, km, lots, ref rnd, size)+ : Mosque(s.Id, At(heart), ground, km, lots, ref rnd, size);case Landmark.Church: return Church(s.Id, At(heart), ground, km, lots, size) ? 1 : 0;default: return 0;}diff --git a/unity/Assets/Tests/EditMode/VillageKitTests.cs b/unity/Assets/Tests/EditMode/VillageKitTests.csnew file mode 100644index 000000000..10b9daaeb--- /dev/null+++ b/unity/Assets/Tests/EditMode/VillageKitTests.cs@@ -0,0 +1,136 @@+#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>Visual gap S1 (docs/visual-v1.md, "Arab villages: dense, terraced cores"): the 1948 localities' Arab villages and+/// towns are dense packs of small stone houses on a plot lattice, at the house scale (100x), and a village's mosque is a+/// village mosque (a one-storey hall with a short square minaret), not the domed town mosque.</summary>+public class VillageKitTests+{+ [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>The Arab localities (villages and Arab towns, Nesher's mixed kit aside).</summary>+ static List<Settlement> ArabLocalities(MapScene map) => map.Localities.Select(p => p.Settlement)+ .Where(s => SettlementKits.ArchetypeOf(s) == Archetype.ArabTown && !Localities.IsMixed(s.Id)).ToList();++ static bool Inside(Vector2 p, SettlementKits.Placed b)+ {+ float a = b.Yaw * Mathf.Deg2Rad, ca = Mathf.Cos(a), sa = Mathf.Sin(a);+ var d = p - b.C;+ float u = d.x * ca + d.y * sa, v = -d.x * sa + d.y * ca;+ return Mathf.Abs(u) <= b.W * 0.5f && Mathf.Abs(v) <= b.D * 0.5f;+ }++ /// <summary>Every Arab locality's houses: the median village (and hill village) at least the village floor, nearly every+ /// village outside the game towns at least six, each house at most the village house's largest real size (5.4 x 5.0 m)+ /// at the house scale, and a hill village's core (inner half radius) built up. Logs one VILLAGES line (the census the PR+ /// quotes) and the villages under six houses.</summary>+ [Test]+ public void ArabVillagesAreDensePacksOfSmallHouses()+ {+ var map = OpenMap();+ TownCensusTests.Census(map, out var placed, out var g);+ var byId = placed.GroupBy(p => p.Id).ToDictionary(x => x.Key, x => x.ToList());+ var counts = new List<int>(); var few = new List<string>(); int openFew = 0, open = 0; var hillCounts = new List<int>(); var hillCore = new List<float>();+ var bad = new List<string>();+ float maxSide = VillageHouseMaxM * KitScale.Houses + 1f;+ foreach (var s in ArabLocalities(map))+ {+ var mine = byId.TryGetValue(s.Id, out var l) ? l : new List<SettlementKits.Placed>();+ var houses = mine.Where(p => p.Kind == "building").ToList();+ counts.Add(houses.Count);+ // A village whose heart lies inside a game settlement's footprint (Silwan in Jerusalem's, Sheikh Muwannis in Tel+ // Aviv's) builds only in its own cell, round the city's houses, which are placed first.+ var wc = map.Frame.ToWorld(s.Lon, s.Lat, 0); var cc = new Vector2(wc.x, wc.z);+ bool inCity = g.Footprints.Any(f => f.id != s.Id && map.Settlements.Any(t => t.Id == f.id) && (cc - f.centre).magnitude < f.radius);+ if (!inCity) open++;+ if (houses.Count < 6) { few.Add($"{s.Id}={houses.Count}{(inCity ? " (in a town)" : "")}"); if (!inCity) openFew++; }+ foreach (var h in houses)+ if (Mathf.Max(h.W, h.D) > maxSide) { bad.Add($"{s.Id}: a house {h.W:0} x {h.D:0} m, over the village house's size"); break; }+ var c = cc;+ if (g.ElevM(c.x, c.y) < 120f) continue;+ // A hill village: the share of its inner half radius (on land) under its houses, sampled every 100 m. Houses only:+ // the mosque alone covers about a third of the core (review of #647), so counting it would pass with no house.+ float R = SettlementKits.FootprintRadiusM(s, g.HexSizeM);+ int n = Mathf.CeilToInt(R / 100f), cells = 0, hit = 0;+ for (int j = -n; j <= n; j++)+ for (int i = -n; i <= n; i++)+ {+ var p = c + new Vector2(i, j) * 100f;+ if ((p - c).magnitude > 0.5f * R || g.Water(p.x, p.y)) continue;+ cells++; if (houses.Any(b => Inside(p, b))) hit++;+ }+ hillCounts.Add(houses.Count); hillCore.Add(hit / (float)Mathf.Max(1, cells));+ }+ counts.Sort(); hillCounts.Sort(); hillCore.Sort();+ int median = counts[counts.Count / 2], hillMedian = hillCounts[hillCounts.Count / 2];+ float coreMedian = hillCore[hillCore.Count / 2];+ string line = $"VILLAGES arab={counts.Count} houses={counts.Sum()} median={median} min={counts[0]} max={counts[counts.Count - 1]} " ++ $"hill={hillCounts.Count} hill_median={hillMedian} hill_core_median={coreMedian:P1} under6={counts.Count(x => x < 6)}";+ TestContext.WriteLine(line); Debug.Log(line);+ TestContext.WriteLine("under six houses: " + string.Join(" ", few));+ Assert.GreaterOrEqual(median, VillageFloor, "the median Arab village draws a dense pack of houses");+ Assert.GreaterOrEqual(hillMedian, VillageFloor, "the median hill village draws a dense pack of houses");+ // Measured 17.5% (houses only, 2026-10-15); the floor sits about 15% under it, as the towns' cover floors do.+ Assert.GreaterOrEqual(coreMedian, 0.15f, "a hill village's core is built up with houses");+ Assert.LessOrEqual(openFew, open / 20, "nearly every village outside the game towns keeps at least six houses");+ CollectionAssert.IsEmpty(bad.Take(20), $"{bad.Count} villages with an oversized house");+ }++ /// <summary>The village house's largest real side (m), as SettlementKits' Style.Village draws it.</summary>+ const float VillageHouseMaxM = 5.4f;+ /// <summary>SettlementKits.VillageFloor: the median village keeps at least its floor.</summary>+ const int VillageFloor = 10;++ /// <summary>The mosque rule (docs/visual-v1.md, "Arab villages: dense, terraced cores"): every Muslim locality keeps a+ /// mosque (all of them are places of 1,000 or more people), but a village's is a village mosque, a one-storey hall with a+ /// short square minaret and no dome, smaller than the domed town mosque that only the Arab towns keep.</summary>+ [Test]+ public void OnlyTheArabTownsKeepTheDomedMosque()+ {+ var map = OpenMap();+ TownCensusTests.Census(map, out var placed, out _);+ var kinds = placed.GroupBy(p => p.Id).ToDictionary(x => x.Key, x => x.ToList());+ var bad = new List<string>(); int villages = 0, towns = 0, villageMosques = 0;+ foreach (var s in ArabLocalities(map))+ {+ if (Localities.LandmarkOf(s.Id) != Landmark.Mosque) continue;+ var mine = kinds.TryGetValue(s.Id, out var l) ? l : new List<SettlementKits.Placed>();+ if (s.Type == "village")+ {+ villages++;+ if (mine.Any(p => p.Kind == "mosque")) bad.Add($"{s.Id}: a domed town mosque in a village");+ var vm = mine.FirstOrDefault(p => p.Kind == "village_mosque");+ if (vm.Kind == null) { bad.Add($"{s.Id}: no village mosque"); continue; }+ villageMosques++;+ if (vm.W > 12f * KitScale.Landmarks) bad.Add($"{s.Id}: its village mosque is {vm.W:0} m wide");+ }+ else+ {+ towns++;+ if (!mine.Any(p => p.Kind == "mosque")) bad.Add($"{s.Id}: an Arab town without its mosque");+ }+ }+ TestContext.WriteLine($"{villages} Muslim villages, {villageMosques} village mosques; {towns} Arab towns");+ Assert.AreEqual(villages, villageMosques, "every Muslim village keeps its (village) mosque (owner: keep, every village)");+ CollectionAssert.IsEmpty(bad.Take(20), $"{bad.Count} mosques against the rule");+ }+}diff --git a/unity/Assets/Tests/EditMode/VillageKitTests.cs.meta b/unity/Assets/Tests/EditMode/VillageKitTests.cs.metanew file mode 100644index 000000000..64248fc54--- /dev/null+++ b/unity/Assets/Tests/EditMode/VillageKitTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 46becd74a33a74749a39a8994e349458\ No newline at end of file