# Optimize: result file format (for the launcher) The engine's Optimize (`engine/framegen/optimize.py`) writes one JSON file per run: * `/optimize/summit-optimize-.json`, and the same content as `/optimize/latest.json`. `` is `oslayer.data_dir()`: `$XDG_DATA_HOME/smoovplay` (`~/.local/share/smoovplay`) on Linux, the settings folder on Windows. The folder sits next to `sessions/`, not inside it, because the launcher reads every `.json` in `sessions/` as a session summary. * With `--results FILE`: the same JSON also as `FILE` with a `.json` suffix, and the text report (`format_text`) in `FILE`. * `python -m framegen.settings` prints, under `"optimize"`: the `--optimize` grammar, the priorities, `format`, `version`, `dir` and `latest` (the paths on this machine) and the quality ranking. A run that was cancelled also writes a file (`"cancelled": true`). ## Starting a run * Command line: `run.py --display --optimize "min=1920x1080@60,priority=quality[,delay=50][,display=2560x1440@144]" [--optimize-budget SECONDS] [--results FILE]`. Priorities: `fps`, `resolution`, `quality`, `delay`. `display=` stands in for the real screen (its size and refresh rate set the ceiling). The engine shows the countdown, then the card for `--result-card` seconds (default 8), then exits. Enter on the card applies and saves #1; Esc closes it. * In a session: the overlay's **Optimize** tab (its settings `opt_min_res`, `opt_min_fps`, `opt_max_delay`, `opt_priority`, `opt_budget` are in the registry like any other), row **Find my settings**. Through `--control` (stdin): `optimize`, `optimize-cancel`, `optimize-apply`, plus `set opt_... ` to choose the inputs first. When a run ends, the engine prints `[optimize] result -> `. ## The file (`format: "summit-optimize"`, `version: 1`) ```jsonc { "format": "summit-optimize", "version": 1, // check both; a later version adds fields, never renames "created": "2026-11-26T07:21:42", "created_unix": 1795670502, "game": "Voidrunner" | null, // SUMMIT_GAME, as the launcher sets it "goal": {"min_resolution": "1280x720", "min_fps": 30, "max_delay_ms": null, "priority": "fps", "text": "..."}, "machine": {"display": "1920x1080", "display_hz": 120.0, "source": "1280x720", "src_fps": 30, "vsr": false, "vfg": false, "trt": false, "max_mult": 10, "motion_fixed": null, "model_fixed": null, "restarts": true, "text": "..."}, "budget_s": 150.0, "elapsed_s": 70.4, "restarts": 0, "cancelled": false, "error": null, "met": true, // false: nothing held the minimums (see failures, closest) "top": [ // best first, at most 3; [] when met is false {"rank": 1, "label": "720p, 2x (60 fps), AMD FSR 1, ...", "settings": {"interp": true, "hz": 60, "model": "4.22.lite", "motion": "half", "engine": "auto", "scaler": "fsr", "vsr_quality": 2, "output_res": "1280x720", "aa": "off"}, "measured": {"fps_avg": 60.0, "low1": 37.1, "frames": 300, "dropped": 0, "delay_ms": 22.0, "stages": {"capture": 0.2, "interp": 4.5, "upscale": 1.1, "present": 2.4}, // average ms "load": 0.24, // share of the time the pipeline worked (AI frames + upscaler + look) "vram_mb": 22789, // the whole card's memory in use, all programs (nvidia-smi), or null "engine_mb": 300, // what this engine had reserved (PyTorch), or null "seconds": 5.0, "took_s": 13.3, "queue_ms": 0.1, "settled": true}, "why": "The highest frame rate that held: ..."} ], "closest": null | {"label": "...", "settings": {...}, "measured": {...}}, // when met is false "failures": [ {"requirement": "low1", "need": 58.2, "got": 37.0, "unit": "fps", "text": "1% low 37 fps, needs 58", "short_by": 21.2, "short_pct": 36.4} ], // the closest one's, when met is false "tried": [ {"label": "...", "settings": {...}, "step": "a higher frame multiplier", "passed": false, "rejected": ["dropped 4 frames (0.9%)"], "measured": {...}} ], // in the order measured "skipped": [ {"label": "...", "settings": {...}, "why": "...", "reason": "at least as heavy as ..., which failed"} ], "quality_ranking": ["Output resolution, up to the display's own size ...", "..."], "not_ranked": "...", "rules": {"headroom": 1.1, "drop_limit": 0.005, "avg_share": 0.95, "at_target": 0.97, "load_limit": 0.909, "warm_s": 2.0, "warm_restart_s": 5.0, "measure_s": 5.0}, "notes": ["...", "Summit changes only its own settings ... can't change the game's own graphics options."] } ``` **Applying a result**: `top[i].settings` holds all nine engine settings Optimize chooses (`interp`, `hz`, `model`, `motion`, `engine`, `scaler`, `vsr_quality`, `output_res`, `aa`), each a valid registry value (`run.py --set KEY=VALUE` takes them, and so does a profile's `[engine]` table). Every other setting stays as the user has it. `model`, `motion` and `engine` take effect after a restart of the pipeline. Values that don't apply in that configuration are copied from the settings in use when the run started (e.g. `hz` with `interp: false`, `vsr_quality` with FSR). ## How a candidate passes (`judge`) * The 1% low (mean of the slowest 1% of frametimes, at least 100 frames) clears the minimum by 10%. When the display's refresh rate leaves no room for that (a 60 Hz screen and 60 fps asked for), the 1% low must reach 97% of the target and the pipeline must be at most ~91% busy. * The average reaches 95% of the rate the multiplier makes; at most 0.5% of frames dropped. * The added delay (median, Summit's own) is under `max_delay_ms` when one is given. * The queue had drained before measuring (`settled`). After a change the engine waits 2 s (5 s after a restart), and then until no frame has queued 50 ms for a whole second (at most 20 s more). Each candidate is then measured for 5 s. ## Headroom (no run) Session summaries (`sessions/summit-session-*.json`) get a `"headroom"` object: `state` (`room`, `fits`, `behind`, `unknown`), `load_pct`, `display_hz`, `output_fps`, `suggestions` (each `{"key", "value", "text", "set": {every setting the change needs}}`), `line` (the overlay's message), `short` and `note`. These are suggestions only: nothing is applied. The `load` is worked out from the stage times, so it is an estimate. Optimize is what measures.