A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Web: a fifth quality fallback step draws the towns' far copies, so weak GPUs recover at the 30 km opening (#2810)
Eyal Golana5cdf2f7057d
diff --git a/changelog.d/web-perf-opening-towns-far.md b/changelog.d/web-perf-opening-towns-far.mdnew file mode 100644index 000000000..5a98982f4--- /dev/null+++ b/changelog.d/web-perf-opening-towns-far.md@@ -0,0 +1,7 @@+### Fixed++- On the web, a device that still runs under 30 frames a second after the automatic quality steps (render scale, then+ the tilt-shift) now gets one more: the towns' buildings draw their lighter far copies, without shadows, at every zoom.+ The game still opens at about 30 km. Since v0.3.5 that opening drew the full building models with their shadows from+ the first frame, and weaker graphics ran at 2-3 frames a second. The step undoes itself as frames recover, and a fixed+ quality choice in Settings clears it.diff --git a/docs/m3-release.md b/docs/m3-release.mdindex 70909c26f..fb9707ae7 100644--- a/docs/m3-release.md+++ b/docs/m3-release.md@@ -68,7 +68,7 @@ start of M4, as a private Draft (owner ruling, 2026-10-10); their sections below- `TURN <n> <date> hash <state hash>` after every End Turn.- `CAMERA distance=<m> yaw=<deg>` with `?camlog`.- `PROFILE ...` with `?profile`.- - `QUALITY level=<n> scale=<s> tiltshift=<on|off> p95_ms=<ms>` whenever the runtime quality fallback steps (WebGL only;+ - `QUALITY level=<n> scale=<s> tiltshift=<on|off> towns=<close|far> p95_ms=<ms>` whenever the runtime quality fallback steps (WebGL only;off with `?nofallback`; docs/visual-v1.md "Runtime quality fallback").- `BOOT phase=<name> at=<ms> ms dt=<ms> ms` for each boot phase with `?bootlog` (playtest 2, P2-1).- `NAV f=<frame> ...` with `?navlog`: every raw mouse event, UI pointer and submit event, screen toggle and map click,diff --git a/docs/visual-v1.md b/docs/visual-v1.mdindex b664a6996..2336c92e0 100644--- a/docs/visual-v1.md+++ b/docs/visual-v1.md@@ -767,9 +767,14 @@ The Deferred row "Runtime quality fallback" (review I1), sized by the DPR-2 stre(pure logic) and `QualityFallbackDriver` (feeds it `Time.unscaledDeltaTime`, applies its step), attached by`CameraRig.Init` through the map's teardown like the visual toggles.- **Steps:** level 0 is the tier (scale 1.0, tilt-shift on); 1: scale 0.9; 2: scale 0.8 (the research's 0.8-1.0 dynamic- range, notes 2.3); 3: scale 0.8 and the tilt-shift off. One step per decision, up in reverse. The scale is the active+ range, notes 2.3); 3: scale 0.8 and the tilt-shift off; 4 (v0.3.7): as 3, and the town building models draw their far-off+ copies without shadows at every zoom (`TownModelLayer.LowTier`), the 30 km opening too. Since v0.3.5 the opening sits+ below the close switch (40 km), so the originals and their shadows draw from the first frame; the nightly's start-screen+ p95 on its software GPU went from 35-88 ms (v0.3.4) to 320-690 ms (v0.3.5, v0.3.6). The opening and the switch stay;+ only a device still over the floor after step 3 loses the originals. One step per decision, up in reverse. The scale is the activeURP asset's `renderScale` (never above the tier's own); the tilt-shift uses its own `TiltShift.FallbackOff`, so stepping- up never turns on a tilt-shift the player (`?notiltshift`) or a profile turned off. The map's teardown puts both back.+ up never turns on a tilt-shift the player (`?notiltshift`) or a profile turned off. The map's teardown puts all three+ back, and a fixed quality choice clears the last two.- **Window: 3 s, back to back, one decision each.** The p95 of a 3 s window is over only when at least 5% of its framesare (5 of 90 at 30 fps), so a one-off hitch (End Turn's redraw, a GC, a first shader compile) never trips it and a realshortfall does within 3 s. Nothing is measured in the first 3 s after the map is built, or 0.5 s after each change; a@@ -788,19 +793,20 @@ The Deferred row "Runtime quality fallback" (review I1), sized by the DPR-2 strecapture target (its renders and `-vprofile` must show the tier's own look), and in the editor a scale change wouldchange the URP asset. Even on WebGL it stays off under `?vprofile`, `?profile` and `?shot` (instruments that must see thetier as configured) and with `?nofallback`; every change logs `QUALITY level=<n> scale=<s> tiltshift=<on|off>- p95_ms=<ms>`.+ towns=<close|far> p95_ms=<ms>`.- **The player's quality choice (#40).** Automatic in Settings is this behaviour. High (the PC tier at render scale 1.0)and Low (the Mobile tier at 0.8) fix the quality: the fallback holds while one is set (`QualityFallbackDriver.Feed`),and every switch starts it again from the top (`GraphicsQuality.Changed`).-- **Presentation only:** it reads no sim state and writes only the render scale and the tilt-shift flag, so turns, hashes+- **Presentation only:** it reads no sim state and writes only the render scale, the tilt-shift flag and the towns' low tier, so turns, hashesand saves cannot change. The goldens and the 5-turn smoke match with it in the build: `uv run tools/web_check.pyunity/Builds/Web-disabled --query "golden&smoke=5"` with the three `--expect` values from `docs/determinism.md`: PASS.- **Tests** (`QualityFallbackTests`, EditMode, synthetic frame times): the step order and range, one step per window andnot before a full window, nothing during start-up, hitches, a pause and 33/34 ms frames do not trigger, recovery inreverse only after 3 good windows, the dead band holds and restarts the count, a failed step up doubles the wait (capped);integration: no driver in the editor; with the web tier's answer forced, `MapScene.Build` attaches one, its steps reach- the URP asset and `TiltShift.FallbackOff` (not `TiltShift.Enabled`), and a rebuild or teardown removes it and restores the- scale.+ the URP asset, `TiltShift.FallbackOff` (not `TiltShift.Enabled`) and `TownModelLayer.LowTier`, and a rebuild or teardown+ removes it and restores the scale and the town originals. `TownModelResidencyTests` checks that the low tier at the+ opening draws Tel Aviv's far copies with no shadow casters, and that clearing it puts the originals back.- **In a real browser** (headed Chrome for Testing, ANGLE Metal, 1920x1080 at DPR 1, under `machine_lock.py --exclusive--wait-unity`, a scratch CDP script on `headed.Browser`): 30 s idle at `--cpu 1`, no `QUALITY` line. With CPU throttlingat 20x from t = 30 s: `QUALITY level=1 scale=0.90 tiltshift=on p95_ms=97.00`, `level=2 scale=0.80 tiltshift=ondiff --git a/unity/Assets/Scripts/Map/GraphicsQuality.cs b/unity/Assets/Scripts/Map/GraphicsQuality.csindex a7f22b760..4099aa912 100644--- a/unity/Assets/Scripts/Map/GraphicsQuality.cs+++ b/unity/Assets/Scripts/Map/GraphicsQuality.cs@@ -65,7 +65,8 @@ namespace Statecraft.Game.Mapif (asset != null)asset.renderScale = c == Choice.High ? HighRenderScale : c == Choice.Low ? LowRenderScale: QualitySettings.names[level] == LowTier ? QualityTierValues.WebRenderScale : 1f;- TiltShift.FallbackOff = false; // a fixed choice ends the fallback's last step; Auto starts it again from the top+ TiltShift.FallbackOff = false; // a fixed choice ends the fallback's last steps; Auto starts it again from the top+ Kits.TownModelLayer.LowTier = false;Changed?.Invoke();}}diff --git a/unity/Assets/Scripts/Map/Kits/TownModelLayer.cs b/unity/Assets/Scripts/Map/Kits/TownModelLayer.csindex a8f3bf48a..8aea9d13d 100644--- a/unity/Assets/Scripts/Map/Kits/TownModelLayer.cs+++ b/unity/Assets/Scripts/Map/Kits/TownModelLayer.cs@@ -35,6 +35,12 @@ namespace Statecraft.Game.Map.Kits/// there, where the kit's 100x houses read better as a mass, and the view's footprint (10,670 km2, about 170 places)/// bounds the cost. The band (12%) is wider than one wheel notch.</summary>public const float FarEnterM = 100000f, FarExitM = 112000f;+ /// <summary>The web tier's last runtime quality fallback step (QualityFallback.Steps, TownModelsFar): every camera+ /// is past the close switch at every zoom, so the towns draw their far-off copies without shadows instead of the+ /// originals with them, at the 30 km opening too. The fallback reaches it only on a device whose frames stay over the+ /// 30 fps floor after its other steps; it steps back off it as frames recover, and the map's teardown and a fixed+ /// quality choice (GraphicsQuality.Apply) clear it. A change takes effect at the camera's next prepare, unmoved.</summary>+ public static bool LowTier;/// <summary>Owner ruling, 31 Oct 2026, "Load all in view (Recommended)": a close camera admits a town or village tile/// whose building-model bounds, widened by ViewMarginM on every side, are in its view; an admitted one stays until it/// leaves the view widened by ViewKeepM, so a pan does not drop and reload a kind at the margin.</summary>@@ -459,7 +465,7 @@ namespace Statecraft.Game.Map.Kits{ choices[key] = choice = new Choice { camera = cam }; changed = true; }choice.lastFrame = Time.frameCount;bool wasClose = choice.close, wasFar = choice.far;- choice.close = CloseAt(ViewDistance(cam), choice.close);+ choice.close = !LowTier && CloseAt(ViewDistance(cam), choice.close);choice.far = FarAt(ViewDistance(cam), choice.far);changed |= wasClose != choice.close || wasFar != choice.far;string[] next = System.Array.Empty<string>();diff --git a/unity/Assets/Scripts/Map/QualityFallback.cs b/unity/Assets/Scripts/Map/QualityFallback.csindex 6d5b288fb..965c41a1d 100644--- a/unity/Assets/Scripts/Map/QualityFallback.cs+++ b/unity/Assets/Scripts/Map/QualityFallback.cs@@ -9,7 +9,8 @@ using UnityEngine.Rendering.Universal;namespace Statecraft.Game.Map{/// <summary>The web tier's runtime quality fallback (issue #44; visual v1 Deferred row "Runtime quality fallback"):- /// when the frame-time p95 stays over the 30 fps floor, lower the render scale, then turn the tilt-shift off; when it+ /// when the frame-time p95 stays over the 30 fps floor, lower the render scale, then turn the tilt-shift off, then draw the+ /// town building models' far-off copies at every zoom (<see cref="Steps"/>); when it/// stays comfortably under, step back up in reverse. Pure logic (frame times in, a step out), so tests drive it with/// synthetic frames; QualityFallbackDriver feeds it the player's frames and applies its step. Presentation only: it/// reads nothing from the sim and changes no sim state, so turns, hashes and saves are the same on every step.@@ -47,13 +48,23 @@ namespace Statecraft.Game.Mappublic readonly struct Step{public readonly float RenderScale; public readonly bool TiltShift;- public Step(float renderScale, bool tiltShift) { RenderScale = renderScale; TiltShift = tiltShift; }- public override string ToString() => string.Format(CultureInfo.InvariantCulture, "scale={0:0.00} tiltshift={1}", RenderScale, TiltShift ? "on" : "off");+ /// <summary>The town building models draw their far-off copies, without shadows, even below the close switch+ /// (TownModelLayer.LowTier).</summary>+ public readonly bool TownModelsFar;+ public Step(float renderScale, bool tiltShift, bool townModelsFar = false) { RenderScale = renderScale; TiltShift = tiltShift; TownModelsFar = townModelsFar; }+ public override string ToString() => string.Format(CultureInfo.InvariantCulture, "scale={0:0.00} tiltshift={1} towns={2}", RenderScale, TiltShift ? "on" : "off", TownModelsFar ? "far" : "close");}/// <summary>Level 0 is the tier's own look; each level down costs less. Render scale first, within the research's- /// 0.8-1.0 dynamic range (notes 2.3), then the tilt-shift.</summary>- public static readonly IReadOnlyList<Step> Steps = new[] { new Step(1f, true), new Step(0.9f, true), new Step(0.8f, true), new Step(0.8f, false) };+ /// 0.8-1.0 dynamic range (notes 2.3), then the tilt-shift, then the town building models' far-off copies at every+ /// zoom: since v0.3.5 the 30 km opening (owner, 3 November 2026, "Open at ~30 km, like the promo") sits below+ /// TownModelLayer.CloseEnterM, so the full originals and their shadows draw from the first frame, and on a weak or+ /// software GPU the nightly's start-screen p95 went from 35-88 ms (v0.3.4) to 320-690 ms (v0.3.5, v0.3.6). A device+ /// that reaches this step still opens at 30 km, with the far copies; a capable one never reaches it.</summary>+ public static readonly IReadOnlyList<Step> Steps = new[]+ {+ new Step(1f, true), new Step(0.9f, true), new Step(0.8f, true), new Step(0.8f, false), new Step(0.8f, false, townModelsFar: true),+ };public const float FloorMs = 33f, OverMs = 34f, RecoverMs = 20f, WindowSeconds = 3f, SettleSeconds = 0.5f, StartupSeconds = 3f, PauseMs = 1000f, ResumeSettleSeconds = 1f;public const int MinWindowFrames = 3, RecoverWindows = 3, MaxRecoverWindows = 48, FailedRecoveryWindows = 2;@@ -128,7 +139,7 @@ namespace Statecraft.Game.Map/// <summary>Feeds QualityFallback the player's frame times (unscaled, so a paused game still counts) and whether the page/// is hidden (document.hidden through DocumentVisibility.jslib, read every frame; never hidden outside the WebGL player), and applies its step:- /// the active URP asset's render scale (never above the tier's own) and TiltShift.FallbackOff. CameraRig.Init attaches it+ /// the active URP asset's render scale (never above the tier's own), TiltShift.FallbackOff and TownModelLayer.LowTier. CameraRig.Init attaches it/// to the map camera through Attach, whose undo (run by the map's teardown) removes it and puts both back.</summary>public sealed class QualityFallbackDriver : MonoBehaviour{@@ -156,6 +167,7 @@ namespace Statecraft.Game.MapGraphicsQuality.Changed -= restart;if (asset != null) asset.renderScale = tierScale;TiltShift.FallbackOff = false;+ Kits.TownModelLayer.LowTier = false;if (driver != null) { if (Application.isPlaying) Destroy(driver); else DestroyImmediate(driver); }};}@@ -169,6 +181,7 @@ namespace Statecraft.Game.Mapvar step = Controller.Current;setScale(Mathf.Min(tierScale, step.RenderScale));TiltShift.FallbackOff = !step.TiltShift;+ Kits.TownModelLayer.LowTier = step.TownModelsFar;Debug.Log(Controller.Line());}diff --git a/unity/Assets/Scripts/UI/SettingsPresenter.cs b/unity/Assets/Scripts/UI/SettingsPresenter.csindex d16102205..a29d19753 100644--- a/unity/Assets/Scripts/UI/SettingsPresenter.cs+++ b/unity/Assets/Scripts/UI/SettingsPresenter.cs@@ -17,7 +17,7 @@ namespace Statecraft.Game.UI/// (#1168, ExternalLink). The blur option turns it off and on: applied at once (TiltShift.Enabled, what the "tiltshift"/// toggle sets) and kept in the SettingsStore, so it holds after a reload. A stored "off" only ever turns the blur off, so ?notiltshift still boots without it. The/// button says what is set ("On" / "Off"), not only a colour: the player's choice (Enabled), not the web tier's- /// automatic last fallback step (TiltShift.FallbackOff), which it never changes.</summary>+ /// automatic fallback's tilt-shift step (TiltShift.FallbackOff), which it never changes.</summary>public sealed class SettingsPresenter : IDisposable{public const string TiltShiftKey = "tiltshift", QualityKey = "quality", LanguageKey = "lang", UiScaleKey = "uiscale", SoundKey = "sfx", MusicKey = "music", CompanionKey = "companion", SelectedClass = "settings-choice-selected";diff --git a/unity/Assets/Tests/EditMode/QualityFallbackTests.cs b/unity/Assets/Tests/EditMode/QualityFallbackTests.csindex bd5a7c5cc..71611c1eb 100644--- a/unity/Assets/Tests/EditMode/QualityFallbackTests.cs+++ b/unity/Assets/Tests/EditMode/QualityFallbackTests.cs@@ -39,10 +39,10 @@ public class QualityFallbackTestsstatic QualityFallback Started() { var q = new QualityFallback(); Run(q, Fine, QualityFallback.StartupSeconds); return q; }[Test]- public void TheStepsLowerTheRenderScaleWithinTheResearchRangeThenTurnTheTiltShiftOff()+ public void TheStepsLowerTheRenderScaleWithinTheResearchRangeThenTurnTheTiltShiftOffThenTheTownModelsGoFar(){var s = QualityFallback.Steps;- Assert.AreEqual(4, s.Count);+ Assert.AreEqual(5, s.Count);Assert.AreEqual((1f, true), (s[0].RenderScale, s[0].TiltShift), "level 0 is the tier's own look");for (int i = 1; i < s.Count; i++){@@ -50,8 +50,15 @@ public class QualityFallbackTestsAssert.LessOrEqual(s[i].RenderScale, s[i - 1].RenderScale);}int firstTiltOff = s.ToList().FindIndex(x => !x.TiltShift);- Assert.AreEqual(s.Count - 1, firstTiltOff, "the tilt-shift goes last");+ Assert.AreEqual(s.Count - 2, firstTiltOff, "the tilt-shift goes after the render scale");Assert.AreEqual(0.8f, s[firstTiltOff - 1].RenderScale, "only once the scale is at its floor");+ // The v0.3.7 web perf fix: the town building models' far-off copies at every zoom come last, once the scale and the+ // tilt-shift are already down, so only a device still over the floor after both loses the 30 km originals.+ int firstTownsFar = s.ToList().FindIndex(x => x.TownModelsFar);+ Assert.AreEqual(s.Count - 1, firstTownsFar, "the towns' far copies go last");+ Assert.AreEqual((0.8f, false), (s[firstTownsFar].RenderScale, s[firstTownsFar].TiltShift), "and keep the other steps");+ Assert.AreEqual("scale=0.80 tiltshift=off towns=far", s[firstTownsFar].ToString());+ Assert.AreEqual("scale=1.00 tiltshift=on towns=close", s[0].ToString());}[Test]@@ -59,11 +66,30 @@ public class QualityFallbackTests{var q = Started();var levels = Run(q, Slow, 60f);- CollectionAssert.AreEqual(new[] { 1, 2, 3 }, levels, "one step per window, never past the last");- Assert.AreEqual(3, q.Level); Assert.IsFalse(q.Current.TiltShift); Assert.AreEqual(0.8f, q.Current.RenderScale);+ CollectionAssert.AreEqual(new[] { 1, 2, 3, 4 }, levels, "one step per window, never past the last");+ Assert.AreEqual(4, q.Level); Assert.IsFalse(q.Current.TiltShift); Assert.AreEqual(0.8f, q.Current.RenderScale);+ Assert.IsTrue(q.Current.TownModelsFar);Assert.AreEqual(Slow, q.LastP95);}+ /// <summary>The towns' far-copy step is undone first as frames recover: after RecoverWindows windows under RecoverMs the+ /// level steps back to the tilt-shift step, with the town originals back. Whole windows (Windows, as+ /// ItRecoversInReverseOnlyAfterSustainedComfortableFrames): a time-based run of slow frames would leave a part-window of+ /// them that spoils the first good window.</summary>+ [Test]+ public void FramesThatRecoverStepOffTheTownsFarStepFirst()+ {+ var q = Started();+ int last = QualityFallback.Steps.Count - 1;+ CollectionAssert.AreEqual(Enumerable.Range(1, last).ToArray(), Windows(q, Slow, last), "one step per slow window, to the last");+ Assert.IsTrue(q.Current.TownModelsFar);+ int n = QualityFallback.RecoverWindows;+ Assert.IsEmpty(Windows(q, Fine, n - 1), "two good windows are not enough");+ CollectionAssert.AreEqual(new[] { last - 1 }, Windows(q, Fine, 1), "the third one steps up");+ Assert.IsFalse(q.Current.TownModelsFar, "the town originals are back");+ Assert.IsFalse(q.Current.TiltShift, "the tilt-shift step is next");+ }+/// <summary>Review M2: the slowest devices (1-3 fps) get the fallback too; a 3 s window of such frames holds only 3-6.</summary>[TestCase(500f)] // 2 fps[TestCase(1000f)] // 1 fps@@ -71,7 +97,7 @@ public class QualityFallbackTestspublic void VerySlowFramesStillStepDown(float ms){var q = new QualityFallback();- CollectionAssert.AreEqual(new[] { 1, 2, 3 }, Run(q, ms, 60f));+ CollectionAssert.AreEqual(new[] { 1, 2, 3, 4 }, Run(q, ms, 60f));Assert.AreEqual(ms, q.LastP95);}@@ -254,15 +280,17 @@ public class QualityFallbackTestsAssert.AreEqual(1, drivers.Length, "the rebuild's teardown removed nothing it should keep, and added one driver");var driver = drivers[0];for (float t = 0; t < 60_000f; t += Slow) driver.Feed(Slow);- Assert.AreEqual(3, driver.Controller.Level);+ Assert.AreEqual(4, driver.Controller.Level);Assert.AreEqual(Mathf.Min(tierScale, 0.8f), asset.renderScale, 1e-6f);Assert.IsTrue(TiltShift.FallbackOff);+ Assert.IsTrue(Statecraft.Game.Map.Kits.TownModelLayer.LowTier, "the last step puts the towns' far copies on");Assert.IsTrue(TiltShift.Enabled, "the tilt-shift toggle (the player's and the profile's) is left alone");map.Build(); // a rebuild tears the old map down first: one driver, back at level 0Assert.AreEqual(1, cam.GetComponents<QualityFallbackDriver>().Length);Assert.AreEqual(tierScale, asset.renderScale, "the old map's teardown put the tier's scale back");Assert.IsFalse(TiltShift.FallbackOff);+ Assert.IsFalse(Statecraft.Game.Map.Kits.TownModelLayer.LowTier, "and the town originals: a new map never starts low");map.Clear(go => Object.DestroyImmediate(go));Assert.IsNull(cam.GetComponent<QualityFallbackDriver>(), "the map's teardown removes the driver");@@ -272,6 +300,7 @@ public class QualityFallbackTests{CameraRig.FallbackWanted = wanted;asset.renderScale = tierScale;+ Statecraft.Game.Map.Kits.TownModelLayer.LowTier = false;EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);}}@@ -319,11 +348,13 @@ public class QualityFallbackTestsGraphicsQuality.Apply(GraphicsQuality.Choice.Auto);for (float t = 0; t < 60_000f; t += Slow) driver.Feed(Slow);- Assert.AreEqual(3, driver.Controller.Level, "on Automatic the fallback steps down as before");+ Assert.AreEqual(4, driver.Controller.Level, "on Automatic the fallback steps down as before");Assert.IsTrue(TiltShift.FallbackOff);+ Assert.IsTrue(Statecraft.Game.Map.Kits.TownModelLayer.LowTier);GraphicsQuality.Apply(GraphicsQuality.Choice.Low);- Assert.IsFalse(TiltShift.FallbackOff, "a fixed choice ends the fallback's last step");+ Assert.IsFalse(TiltShift.FallbackOff, "a fixed choice ends the fallback's last steps");+ Assert.IsFalse(Statecraft.Game.Map.Kits.TownModelLayer.LowTier, "the town originals too");GraphicsQuality.Apply(GraphicsQuality.Choice.Auto);Assert.AreEqual(tierScale, asset.renderScale, 1e-6f, "Automatic puts the tier's own scale back");driver.Feed(Fine);@@ -333,6 +364,7 @@ public class QualityFallbackTestsfinally{GraphicsQuality.Apply(GraphicsQuality.Choice.Auto);+ Statecraft.Game.Map.Kits.TownModelLayer.LowTier = false;QualitySettings.SetQualityLevel(level, true);asset.renderScale = tierScale; mobile.renderScale = mobileScale;Object.DestroyImmediate(go);diff --git a/unity/Assets/Tests/EditMode/TownModelResidencyTests.cs b/unity/Assets/Tests/EditMode/TownModelResidencyTests.csindex 97ab1ea9b..5235882ef 100644--- a/unity/Assets/Tests/EditMode/TownModelResidencyTests.cs+++ b/unity/Assets/Tests/EditMode/TownModelResidencyTests.cs@@ -1040,6 +1040,37 @@ public class TownModelResidencyTests}}+ /// <summary>The v0.3.7 web perf fix: the web tier's last quality fallback step (QualityFallback.Steps, TownModelsFar)+ /// sets TownModelLayer.LowTier. Over Tel Aviv at the 30 km opening (CameraRig.StartDistance, below the close switch) the+ /// buildings then draw their far-off copies with no shadow casters instead of the originals with every building+ /// casting; clearing it puts the originals and their shadows back, both with the camera unmoved.</summary>+ [Test]+ public void TheLowTierDrawsTheFarCopiesWithoutShadowsAtTheOpeningAndClearingItPutsTheOriginalsBack()+ {+ using var s = new StreamedMap();+ var at = s.Footprint("tel_aviv").centre;+ var camera = s.Camera(at, CameraRig.StartDistance);+ try+ {+ s.Settle(camera); s.Submit(camera);+ Assert.IsTrue(s.layer.LastClose, "control: the opening is close, the originals draw");+ Assert.Greater(s.layer.LastDrawn, 0);+ Assert.AreEqual(s.layer.LastDrawn, s.layer.LastShadowCasters, "control: every building casts");++ TownModelLayer.LowTier = true;+ s.Settle(camera); s.Submit(camera);+ Assert.IsFalse(s.layer.LastClose, "the low tier is past the close switch at the opening");+ Assert.Greater(s.layer.LastDrawn, 0, "Tel Aviv's buildings still draw (the far copies)");+ Assert.AreEqual(0, s.layer.LastShadowCasters, "and cast no shadows");++ TownModelLayer.LowTier = false;+ s.Settle(camera); s.Submit(camera);+ Assert.IsTrue(s.layer.LastClose, "clearing it puts the originals back, the camera unmoved");+ Assert.AreEqual(s.layer.LastDrawn, s.layer.LastShadowCasters, "with their shadows");+ }+ finally { TownModelLayer.LowTier = false; }+ }+/// <summary>The shadows follow the close switch with its hysteresis (TownModelLayer.CloseAt: in below CloseEnterM, 40 km,/// out above CloseExitM, 45 km). Over Tel Aviv, coming in: none at 90 km and at 42 km (inside the band, still far), all/// at 39 km; going out: all at 43 km (inside the band, still close), none at 46 km.</summary>