Cradle: waiting for a second frame
What a native overlay should do when its understanding comes from pixels.
Try example ↗Cradle began around Marathon and uses native Swift, OCR and visual parsing to work with what is on screen. Unlike an application reading its own structured data, an overlay has to infer which interface it is looking at. A fleeting frame can be convincing and still be wrong.
The overlay follows supported remote-play windows and displays inventory or trade information. Its capture code also has a main-display fallback when no supported window is found.
Recognizing a screen is not yet showing a chip
OverlayPresentationGate separates recognition from presentation. Without the explicit-index override, it waits for two matching observations to return show and two missing observations to return hide. A single observation returns hold, preserving the visible state.
Two matching frames
Feed the overlay a matching or missing frame and observe its decision.
- First match: hold
- Second match: show
- First miss: hold
- Second miss: hide
if hasState {
matchingFrames += 1
missingFrames = 0
return explicitIndex || matchingFrames >= 2 ? .show : .hold
}
missingFrames += 1
matchingFrames = 0
return explicitIndex || missingFrames >= 2 ? .hide : .holdGive uncertainty a place in the pipeline
- Capture window
- OCR / visual parsing
- Recognized screen state
- Presentation gate
- Native overlay
The gate is small enough to understand independently of the recognizer. Feed it match, miss, match: the overlay stays hidden. Feed it match, match: it can appear. Once visible, one missing observation leaves it in place. That temporal behavior reduces flicker without pretending the recognizer is certain.
Stability has a cost
Waiting for confirmation introduces delay. The README describes roughly 0.7-second sampling, so presentation timing depends on when the screen changed relative to capture. Two matching frames also do not establish semantic correctness: a consistently wrong recognizer can still pass the gate.
A missing source window and the explicit-index override take separate paths. This example covers ordinary matching and missing observations. It does not run capture or OCR.
Try matching and missing frames in the behavioral port. It establishes the gate's hold/show/hide logic, not OCR or the native overlay.