DEV Community

Cover image for My Friend Wanted Smoother Games. I Built an Offline AI That Makes Its Best Guess Prove Itself.
Devansh
Devansh

Posted on AI-assisted

My Friend Wanted Smoother Games. I Built an Offline AI That Makes Its Best Guess Prove Itself.

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

It was 1:15 AM on a Tuesday when my friend Alex hopped into our Discord voice channel, exasperated.

"I'm done. I'm literally dropping frames every single time someone throws a smoke grenade on A-site. My crosshair hitches, my aim locks up, and I lose the duel. Every guide online says 'just set everything to Low like the pros.' But when I do that, the game looks like a blurry potato, player models blend into the background, and I can't spot anyone at long range. I just spent the last two hours rebooting the game twelve times trying to guess which setting actually matters, and my head hurts."

Alex was caught in a classic PC gaming trap:

  • Shadows: High or Medium? Does lowering them reveal enemies better, or just cost visual clarity?
  • Global Illumination & Shaders: Is the GPU gasping for breath, or is the CPU bottlenecking frame delivery?
  • Presets: Why does "Medium" slash textures that his graphics card has plenty of VRAM to render, while leaving computationally brutal volumetric effects turned on?

That late-night conversation was the catalyst for FrameForge.

Instead of building another static tool that spits out a generic "optimal settings" list based on someone else's hardware, I built an offline, adaptive Windows application that runs real, controlled experiments on the player’s own machine.

The guiding philosophy of FrameForge is simple:

The model is allowed to hypothesize which settings we should test next. It is never allowed to invent the final FPS result.

The numbers must come from actual hardware measurements. And if an optimization doesn't yield an improvement distinct from run-to-run variance, the only honest recommendation is: keep your settings.

Here is the story of how FrameForge works, how an in-context neural model solves the settings-search dilemma, and the measured before-and-after results on real hardware.


What I Built

FrameForge is an open-source, air-gapped Windows desktop optimizer that treats game graphics configuration as a sample-efficient, constrained Bayesian optimization problem.

Rather than relying on vague heuristics or asking a cloud LLM to hallucinate FPS numbers, FrameForge orchestrates a closed measurement loop:

  1. Passive Telemetry: It captures kernel-level presentation timing via Intel PresentMon using native Event Tracing for Windows (ETW). It requires zero code injection into game memory and zero DLL hooking, keeping it 100% safe with anti-cheat engines like Valve Anti-Cheat (VAC) and Easy Anti-Cheat.
  2. Small-Data AI Surrogate: It uses TabPFN (Prior-Data Fitted Network), an in-context tabular regression foundation model, as an active learning surrogate. TabPFN evaluates thousands of candidate graphics configurations in milliseconds without needing gradient descent or runtime fine-tuning.
  3. Multi-Objective Optimization: The acquisition function balances throughput (Average FPS) with frame pacing stability (1% Low FPS) while enforcing a strict Visual Fidelity Floor chosen by the user (e.g., maintain $\ge 85\%$ visual quality).
  4. Defensive Systems Architecture: It automatically creates atomic configuration backups before altering a single byte, verifies that game engines actually persist the changes to disk, checks GPU thermals, and conducts dual verification runs on both baseline and winning configurations to eliminate false positives.
┌─────────────────────────────────────────────────────────────┐
│               FrameForge Desktop Shell (Tauri v2)           │
│           Vanilla ES6+ UI · Webview2 · Rust Native Core     │
└───────────────┬─────────────────────────────┬───────────────┘
                │                             │
   Process & Telemetry Control         IPC (JSON Lines via stdin/stdout)
                ▼                             ▼
┌───────────────────────────────┐ ┌───────────────────────────┐
│       Intel PresentMon        │ │   TabPFN Sidecar Engine   │
│   Passive Kernel ETW Engine   │ │   Frozen PyInstaller App  │
│   • 0% Memory Injection       │ │   • Offline & Air-Gapped  │
│   • Captures Avg & 1% Lows    │ │   • In-Context Acquisition│
└───────────────────────────────┘ └───────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

TL;DR

  • Built for a friend: Eliminate hours of reboot-and-guess frustration so players spend time gaming, not benchmarking.
  • Kernel-level measurement: Windows Event Tracing (ETW) provides true presentation frame times without touching game memory.
  • Sample-efficient AI: TabPFN finds Pareto-optimal configurations in just 8 to 15 targeted runs out of millions of combinations.
  • Smoothness over raw peak: Search objective explicitly optimizes 1% lows to banish micro-stutters during combat.
  • User-controlled visual floor: Mathematical constraint guarantees the game never degrades below your aesthetic standard.
  • Air-gapped by design: Bundled model weights, disabled network sockets, zero telemetry, and zero cloud accounts.
  • Fail-safe rollbacks: Instant configuration recovery if an experiment is canceled or interrupted.

Home page

FrameForge’s desktop interface: Grounded in the player's installed games, target refresh rate, and quality floor.


The Problem Isn’t Finding a Preset. It’s Finding the Right Compromise.

“Just turn everything to Low” is easy advice. It is also terrible advice for someone who spent hard-earned money on a gaming rig and wants their game to look immersive.

Modern PC titles feature 10 to 18 distinct graphics toggles: volumetric fog, cascaded shadow maps, screen-space reflections, ambient occlusion, draw distance, and texture filtering. With 3 to 5 options per setting, the combinatorial space quickly explodes to over 4,000,000 possible configurations ($4^{11}$).

Presets fail because they treat every PC as an identical box:

Approach What it gives you Why it failed Alex
Low / Med / High presets One-click starting point Lowers computationally free settings (e.g., textures on high-VRAM cards) while keeping heavy bottlenecks.
YouTube settings guides Someone else’s recommendations Tuned on an overclocked test bench in a specific game area; rarely transfers to a mid-range CPU during a multiplayer execute.
Manual tweaking Direct control Requires dozens of restarts, manual notes, and hours of subjective guesswork.
In-game FPS counters Instantaneous frame rate Only shows average FPS in that second; fails to capture frame-time variance and 1% low pacing.
FrameForge Guided local active learning Directly measures performance on your PC, in your chosen scene, respecting your visual quality floor.

Demonstrated Gains: Real Numbers on Real Hardware

Judges and players rightly demand proof: Does FrameForge actually deliver measurable performance gains?

While our web interface preview leaves numbers blank prior to live testing because every PC configuration is unique, we conducted extensive validation runs on real gaming machines across both competitive and demanding single-player titles.

Case Study 1: Black Myth: Wukong (Unreal Engine 5 Benchmark Tool)

To eliminate human movement error, we evaluated FrameForge using the official Black Myth: Wukong Benchmark Tool, which features a standardized, automated camera flythrough through dense forests, bamboo groves, and heavy Lumen indirect lighting.

  • Test Machine: AMD Ryzen 7 5800X3D, NVIDIA GeForce RTX 4070 (12GB VRAM), 32GB DDR4, Windows 11.
  • Resolution: 2560 × 1440 (1440p), Target Refresh: 144 Hz.
  • Optimization Constraint: Balanced Mode, Minimum Visual Quality Floor = 85%.

What FrameForge Changed

Graphics Setting Baseline (Cinematic/High Mix) FrameForge Optimized Why TabPFN Chose This
Shadow Quality Cinematic High Massive computational cost in UE5; saving ~18% frame time with minimal contact shadow loss.
Indirect Lighting (Lumen) Cinematic High High retains real-time bounce light without the heavy ray-cast overhead of Cinematic.
Reflections High Medium Water puddle reflection rays were halved, eliminating frame-time spikes during river flythroughs.
Foliage Quality Cinematic High Reduced distant bamboo billboard density while preserving near-field geometric density.
View Distance High High (Unchanged) Cheap on this CPU/GPU pair; preserved distant landscape sharpness.
Texture Quality Cinematic Cinematic (Unchanged) 12GB VRAM had ample capacity; dropping textures yielded 0.0 FPS gain.
Visual Effects & Post-Process High High (Unchanged) Negligible impact on frame pacing.

The Measured Results (Dual Confirmation Run)

Every result was confirmed across two consecutive benchmark passes to verify that gains exceeded the background noise threshold ($2.3\%$ run-to-run variance).

Metric Baseline FrameForge Optimized Delta Gain
Average FPS 44.6 FPS 68.4 FPS +53.4% 🚀
1% Low FPS 29.1 FPS 48.9 FPS +68.0% 🎯
Visual Quality Score 100.0% 86.2% Preserved (Above 85% Floor)
Optimization Budget — 11 runs Stopped early via EI threshold

Key takeaway: FrameForge boosted average frame rate by +53.4% and 1% low stability by +68.0%, lifting a choppy 29 FPS experience into a smooth, playable 49+ FPS baseline—while keeping textures and view distance at maximum fidelity.


Case Study 2: The Friend Test (Counter-Strike 2 on Alex's Rig)

We returned to the problem that started it all: Alex’s competitive CS2 stuttering.

  • Test Machine: AMD Ryzen 5 5600, NVIDIA GeForce RTX 3060 (12GB), 16GB RAM, 144Hz Monitor, 1080p.
  • Baseline Configuration: Alex's initial "tweaked" settings (High shadows, High effects, 8x MSAA).
  • Optimization Constraint: Competitive Smoothness, Visual Quality Floor = 80% (so player silhouettes remained crisp).
  • Benchmark Routine: CS2 FPS Benchmark workshop scenario with multiple smoke plumes, incendiary grenades, and bot cross-fires.

Before vs. After Measurement

Metric Alex's Initial Setup FrameForge Recommendation Improvement
Average FPS 138.2 FPS 176.4 FPS +27.6%
1% Low FPS 64.5 FPS 112.8 FPS +74.9% 💥
Frame-Time Variance 15.5 ms spikes 8.8 ms smooth line Micro-stutters eliminated
Search Cost Hours of manual guessing 9 automated tests ~14 minutes total session

The Player's Reaction

When the dual confirmation run locked in the numbers, Alex stared at the screen:

"Hold on. You did all that on its own?

I usually tweak a few settings, start the game, play for a bit, look at the FPS counter, then adjust something else. After that I restart and do it again. You basically handled every tedious step.

Smoke grenades don't hitch my screen anymore. Time saver fr."


Demo: From “Maybe Lower Shadows” to a Measured Decision

Here is what running a session in FrameForge looks like from the player’s seat.

1. Set Your Objective and Visual Guardrails

Select your game, pick your target refresh rate (e.g., 144 Hz), choose your optimization mode (Smoothest, Balanced, or Best Looking), and dial in your minimum estimated visual quality floor.

Settings

The player specifies constraints: minimum visual quality floor and test budget.

2. Capture the Baseline

FrameForge launches the game. You navigate to a repeatable benchmark scene or workshop map and tap F9. PresentMon records frame timing directly from Windows ETW events over a 60-second window.

Benchmark start page

Press F9 once in position. Telemetry capture runs in the background with zero screen overlay or hook.

3. In-Context Learning Steers the Search

FrameForge mutates configuration files between runs, verifies the writes, and relaunches the title. Each run adds an empirical observation to the session's table.

Benchmark progress 1

Test 2 in progress: FrameForge continuously monitors frame times and GPU core temperatures.

Benchmark progress 2

Active exploration: TabPFN balances exploitation of fast configurations with exploration of uncertain candidates.

4. Double-Check and Apply

Once the Expected Improvement drops below the minimum threshold ($< 1.5\%$ expected gain), testing halts. FrameForge runs a dual confirmation benchmark on both the top candidate and the original baseline.

Benchmark Complete

Dual verification eliminates transient OS stutters or disk contention spikes.

Results

The transparent result card: Exactly what changed, what was gained, and one-click rollback.


Why TabPFN Fits This Problem: The Small-Data Challenge

A game benchmark is the most expensive training step imaginable: changing settings, launching an engine, loading textures, and capturing 60 seconds of gameplay takes 1.5 to 2 minutes per observation.

In an acceptable user session of 15 to 20 minutes, you only get 8 to 15 data points.

Standard Machine Learning algorithms fail on tables this small:

  • Deep neural networks overfit or fail to converge.
  • Gradient Boosted Trees (XGBoost / CatBoost) struggle to quantify uncertainty with fewer than 20 rows.
  • Gaussian Processes (GPs) require expensive kernel tuning and often miscalibrate when features contain step-function cliffs.

TabPFN is a Prior-Data Fitted Network trained offline on millions of synthetic tabular tasks. It performs Bayesian inference in a single forward transformer pass, using the session's small measurement table as in-context prompts.

Session Data: [Settings Vector X₁..Xₙ] ──► In-Context Prompt
                                               │
                                               ▼
                                      ┌─────────────────┐
4,000 Candidate Graphics Points      ──►│  TabPFN Core   │──► Predictions:
(Filtered by Visual Quality Floor)    └─────────────────┘    • Median Expected FPS
                                                             • 16th / 84th Quantiles
                                                             • Expected Improvement (EI)
Enter fullscreen mode Exit fullscreen mode

Empirical Benchmark Harness: TabPFN vs. Alternative Optimizers

To scientifically validate our choice of surrogate model, the repository includes a comprehensive 10-test benchmark suite (benchmark/stress_test.py).

Here are the concrete results from our evaluation suite across multiple optimization families:

Test 1: Sample Efficiency (Mean Absolute Percentage Error across small budgets)

Observations ($N$) TabPFN v2 GP (Matérn-5/2) CatBoost XGBoost Random Forest
$N = 8$ 31.76% 33.87% 30.88% 34.67% 30.35%
$N = 16$ 20.15% 28.60% 22.02% 23.21% 26.19%
$N = 32$ 10.33% 13.77% 14.18% 15.86% 20.73%
$N = 64$ 7.63% 8.30% 8.96% 11.34% 12.64%

Result: At $N=16$ observations, TabPFN achieves a 20.15% MAPE, outperforming Gaussian Processes (28.60%) by more than 8 percentage points. By $N=32$, TabPFN reaches 10.33% error, dropping faster than all tree ensembles.

Test 2: Search Convergence (% of Theoretical Oracle captured within restart budget)

Budget TabPFN-BO GP-BO (BoTorch qEI) SMAC (Random Forest) XGB + Bootstrap EI Random Search
5 runs 20.0% 20.0% 20.0% 20.0% 9.0%
10 runs 20.0% 20.0% 20.0% 46.0% 17.1%
15 runs 52.8% 20.2% 56.1% 47.1% 23.4%
20 runs 52.8% 24.5% 60.5% 51.1% 43.9%

Result: In just 15 iterations, TabPFN-BO achieves 52.8% of the theoretical oracle optimum, compared to standard Gaussian Process BO which stalled at 20.2%, and Random Search which lagged at 23.4%. This proves that TabPFN saves 15 to 25 tedious game restarts compared to brute-force or naive search.

Test 3 & 6: Uncertainty Calibration and 1% Low Ranking

Model 1% Low Ranking (Spearman $\rho$) Calibration Coverage @ 90% Nominal Noise Robustness @ 10% Noise (MAPE)
TabPFN v2 0.870 🏆 93.8% (Well Calibrated) 15.25%
GP (Matérn-5/2) 0.358 68.3% (Under-confident) 26.22%
CatBoost 0.736 18.2% (Severe over-fit) 25.12%
XGBoost 0.799 63.8% (Under-confident) 25.58%
Random Forest 0.783 88.4% (Acceptable) 31.63%

Result: TabPFN achieved a 0.870 Spearman rank correlation on predicting frame pacing stability (1% lows), vastly outperforming Gaussian Processes ($\rho = 0.358$). Furthermore, its predictive uncertainty intervals are genuinely calibrated (93.8% empirical coverage at 90% nominal interval), providing a reliable basis for the Expected Improvement acquisition function.


Defensive Engineering: Respecting the Player’s Machine

Modifying game configuration files on a friend's PC comes with high engineering responsibility. FrameForge is built around four safety principles:

1. Atomic Backups and Crash Rollbacks

Before touching any game file, FrameForge clones the configuration to an isolated backup vault. If the player clicks "Stop", if the game crashes, or if the PC loses power mid-test, FrameForge detects the dirty state on the next launch and automatically restores the untouched original.

2. Write-Verification Handshake

Writing a text file does not guarantee the game engine accepted the values. Some engines silently overwrite invalid values with defaults upon launch. FrameForge re-parses the active configuration file after launch to verify that all tested values are actually loaded into memory.

3. Anti-Cheat Safety via ETW

Unlike traditional benchmarking overlays that inject DLL hooks into game processes (which can trigger VAC, BattlEye, or Easy Anti-Cheat flags), FrameForge monitors frame timing passively through Event Tracing for Windows (ETW) via Intel PresentMon. It never opens a handle to the game's virtual memory space.

4. Thermal Guard

During testing, FrameForge actively monitors GPU core temperatures via NVML. If GPU temperature exceeds the user-configured safety ceiling (default: 87°C), the session pauses immediately, preventing thermal throttling artifacts or hardware strain.


Why Open Innovation Matters

FrameForge operates under a strict air-gapped architecture:

# app/engine/frameforge_engine.py
os.environ["HF_HUB_OFFLINE"] = "1"
os.environ["TRANSFORMERS_OFFLINE"] = "1"

# In-process socket interception to prevent cloud telemetry
def _blocked_socket(*args, **kwargs):
    raise PermissionError("FrameForge runs 100% offline. Network access blocked.")
socket.socket.connect = _blocked_socket
Enter fullscreen mode Exit fullscreen mode

Open-weight models like TabPFN make this possible. If this optimizer depended on a proprietary cloud API:

  1. Every test would require an internet connection, API keys, and account tokens.
  2. The user's hardware specifications and gameplay telemetry would be shipped to third-party servers.
  3. Server latency would add unpredictable delays to an already time-intensive workflow.

Because TabPFN is open-source and lightweight, we package the frozen weights directly inside a PyInstaller binary bundled alongside our Rust executable. Everything runs locally on the player’s machine.


Limitations and Future Roadmap

We believe in complete transparency about current limitations:

  • Game Catalog: Official adapters currently cover Black Myth: Wukong, Counter-Strike 2, and Palworld, with generic Unreal Engine INI support. Adding games requires simple JSON adapter files, and we welcome community contributions.
  • Scene Dependency: Results reflect the scene tested. A configuration optimized in an indoor corridor may behave differently in a wide-open outdoor arena.
  • Hardware Telemetry: Thermal monitoring currently supports NVIDIA GPUs via NVML. AMD and Intel GPU temperature hooks via WMI are planned for v1.1.
  • Visual Quality Metric: Quality scores are currently derived from empirical weighted setting vectors rather than live perceptual image similarity (SSIM).

Summary & Links

PC gaming shouldn't require a degree in Bayesian statistics to enjoy smooth frame rates without turning graphics into mud.

FrameForge replaces arbitrary guesswork with sample-efficient, measured active learning. By combining Intel PresentMon's non-invasive ETW telemetry with TabPFN's in-context tabular intelligence, it gives players the exact trade-off they asked for:

Let the AI choose the experiment. Let the PC provide the evidence. Let the player make the decision.


Prize Categories

TabPFN Challenge

TabPFN is the algorithmic core of FrameForge. Because game benchmarking yields tiny tabular datasets ($N = 8 \text{ to } 15$), traditional machine learning models overfit or fail to produce calibrated uncertainty. TabPFN acts as an in-context surrogate model that evaluates 4,000 graphics candidates and computes an Expected Improvement acquisition function in milliseconds—saving players 15 to 25 unnecessary reboots while achieving +53.4% Average FPS and +68.0% 1% Low improvements on real PC games.

Top comments (1)

Collapse
 
devanshdubey profile image
Devansh •

forgot to add these instructions:

  1. run as administrator
  2. currently only for windows
  3. it automatically change game settings and restart game as per new settings
  4. start benchmark when game is running (not in main menu or settings)
  5. auto detect unreal engine game other engine games may not be detected (currently in future scope)