fix(ui): fill build-zone overlay masks in one pass, not per texel - #116
Open
cubetribe wants to merge 1 commit into
Open
fix(ui): fill build-zone overlay masks in one pass, not per texel#116cubetribe wants to merge 1 commit into
cubetribe wants to merge 1 commit into
Conversation
Play-observation finding: the game hitched and felt 'delayed' exactly while placing buildings. Root cause: the 21.4 overlay asked IsInsideBuildInfluence and HasMinimumBuildingSpacing PER TEXEL — every texel rescanned the placement register, and each entry paid a linear site-register probe for the D-108 finished-only rule. That is several hundred million operations per repaint at the 4 Hz cadence — a main-thread hitch four times a second in the placement phase. FillBuildZoneMasks fills both masks in ONE pass: both predicates are rectangle-Chebyshev distances between uniform footprints, so the exact answer set per register entry is a square of candidate origins (influence half-extent BuildInfluenceRadiusCells + f - 1; spacing half-extent MinimumBuildingDistanceCells + f - 2). Filters mirror the per-cell reads (finished own anchors for influence, all sites and living placements for spacing). The per-cell reads stay the validator path; an EditMode test pins mask == direct reads over the full grid, including an active site and an enemy building. Same picture, no hitch. No simulation behaviour change, no baseline movement. Verified: dotnet test 726/726; Unity EditMode 606/606 (1 new).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was
Hotfix für den Spielbericht „das Spiel ist komisch verzögert / ruckelt beim Bauen". Die Ursache lag im 21.4-Baubereich-Overlay (#112):
RepaintfragteIsInsideBuildInfluenceundHasMinimumBuildingSpacingpro Texel ab — ~16.000 Texel × Platzierungsregister-Scan × lineare Baustellenprobe (IsActiveSite) = mehrere hundert Millionen Operationen pro Repaint, 4× pro Sekunde, ausgerechnet während ein Bau-Ghost armiert ist.Jetzt füllt
ConstructionSystem.FillBuildZoneMasksbeide Masken in einem Register-Pass pro Repaint. Das ist keine Annäherung: beide Prädikate sind Rechtecks-Chebyshev-Distanzen zwischen uniformen 3×3-Footprints, also ist die Antwortmenge pro Registereintrag exakt ein Quadrat von Kandidaten-Ursprüngen (Einfluss: HalbkanteBuildInfluenceRadiusCells + f − 1; Abstand:MinimumBuildingDistanceCells + f − 2). Die Filter spiegeln die Direkt-Reads (Einfluss: eigene, lebende, fertiggestellte Gebäude — D-108; Abstand: alle Baustellen und lebenden Platzierungen aller Besitzer). Die Per-Zell-Reads bleiben der Weg des Validators; das Overlay liest nur noch Masken.Selbes Bild, kein Hitch. Gemessen am Aufwand: ~140.000 statt ~300.000.000 Operationen pro Repaint.
Nachweis
dotnet test tools/Nova.SimRunner.Tests -c Release: 726/726 grünFillBuildZoneMasks_MatchesThePerCellReads_OnEveryCellpinnt die Masken über das gesamte Raster gegen die Direktaufrufe (inkl. aktiver Baustelle und feindlichem Gebäude), das Bild kann nicht von der Regel driftenConstructionSystembekommt genau eine neue öffentliche Lese-Methode (Präzedenz feat(presentation): Baubereich als Overlay sichtbar machen (#91, Paket 21.4) #112: die zwei Overlay-Reads)integration/s21-review, lokal); Befund war Ruckeln/Verzögerung in der BauphaseBetroffene Bereiche
ConstructionSystem.cs(+1 öffentliche Lese-Methode + private Box-Füllung),BuildZoneOverlayView.cs(Repaint liest Masken),BuildZoneOverlayQueryTests.cs(+1 Test),CHANGELOG.md(eine Zeile unter[Unreleased]→ Behoben).