Skip to content

How Detect Grid works ​

Detect Grid measures the presented picture over a short session. It works from those pixels, without looking up an expected resolution for the game.

When detection runs ​

The detector runs when you choose Detect Grid or Re-detect Grid in the overlay. Between sessions it stops capturing and analyzing frames. Run detection again after changing the output size or the game’s internal pixel scaling.

Beamline captures the picture before drawing its treatment and overlay, keeping its own scanlines out of the measurement. It checks capture identity, orientation and bounds, and rejects stale images.

A session gathers a short sequence of captures, then analyzes their horizontal and vertical profiles together. Spreading the observations over time helps distinguish a stable grid from a pattern in one frame.

Turning pictures into evidence ​

The extractor converts RGB to a weighted luma signal and computes absolute differences between adjacent columns and adjacent rows. These derivatives emphasize transitions where pixel boundaries may be visible.

It retains several complementary summaries:

  • Luma bands help estimate relative displacement between observations.
  • Mean and percentile edge bands describe horizontal and vertical repetition without reducing the entire image to one undifferentiated profile.
  • Spatial-activity projections show where detail exists, helping distinguish active content from flat regions.
  • Multiple observations test whether a candidate remains coherent over time rather than appearing in one convenient frame.

The backend supplies the visible analysis rectangle. The detector estimates active bounds inside it from image activity. Keeping their origins through analysis prevents a crop-local phase from being saved as a full-image coordinate.

Searching for pitch ​

X and Y have independent estimates, allowing rectangular cells and unequal stretching. The final pair must still pass consistency and spatial checks together.

The search refines distinct score peaks and compares neighboring pitches, harmonics and subdivisions.

Scoring combines four kinds of evidence:

  1. Spectral coherence: do edge weights accumulate at a consistent phase for this period?
  2. Boundary concentration: are those weights concentrated near the proposed repeating boundaries rather than uniformly distributed?
  3. Autocorrelation: does the edge profile resemble itself when shifted by the period and twice the period?
  4. Temporal consistency: does the periodic evidence remain coherent across the observed sequence?

The spectral part can be understood through a weighted phasor sum:

text
Z(p) = sum over positions u of w(u) * exp(-i * 2*pi*u/p)

Here p is candidate pitch and w(u) is edge evidence. The normalized magnitude describes coherence; the angle helps estimate phase. This sum is one part of acceptance. A repeating sprite or HUD can produce a sharp peak that fails the other checks.

Where the repetition occurs matters ​

Distributed tile tests check support and phase agreement across the image. Joint X/Y locality checks ask whether the proposed pair actually describes detail in the same regions. A horizontal period in one panel and a vertical period somewhere else do not automatically prove a two-dimensional lattice.

The detector compares competing periods, coarser parents and finer subdivisions. Folded derivatives can support intermediate boundaries at the proposed pitch. A repeated panel, minimap or sprite motif must also pass coverage checks before its grid can apply beyond that region.

Phase is a separate problem from pitch. Two regions can repeat every four pixels while starting two pixels apart. The detector estimates phase from unsmoothed edges, because smoothing can invert a high-frequency component. It also checks regional consistency rather than assuming a pooled phase belongs to every region.

Deciding what can be saved ​

Beamline saves a grid only after it passes the spatial and temporal checks. It first tries to accept measured pitch and phase together. It can also accept spacing with a chosen Manual-equivalent anchor.

Cancellation, failure or a failed save leaves the previous calibration intact. A successful result is stored for the game installation and exact presentation dimensions.