Back to work

Relative AI, two-PC Valorant vision system

A real-time, distributed computer-vision and closed-loop control system. The game PC sees and understands the game; a second PC decides how to move and click; a hardware device delivers the resulting input back. Feature-complete and in daily private use. How perception gets its frames is the one part that stays off the record - the rest is fair game.

Role Sole engineer · Stack C++17, Python, ONNX Runtime · Hardware Medius/MAKCU, two-PC LAN · Status Private build, in daily use

Metadata over the wire, not video.

The first working version streamed compressed frames to the second PC and ran the model there. It was the wrong shape: WiFi transport and a weaker second machine made decode-and-infer the bottleneck, and the network footprint was enormous for what the control side actually needed.

The rewrite moved all perception onto the game PC. A native C++17 module runs a custom-trained 256×256 YOLO model on DirectML (with a contained CPU fallback), selects a target near the crosshair, keeps its identity stable across detector dropouts, and measures how old the frame is. What crosses the LAN is a 32-byte packet: the selected box, target ID, confidence, class, head-anchor setting, and measured capture age. At 60 packets per second that is 1.92 KB/s of application payload - the entire video transport problem deleted rather than optimised.

The second PC runs a Python bridge that receives those packets and drives a 250 Hz motion controller. Its output goes over a 6 Mbaud serial link to a Medius/MAKCU device, which presents ordinary hardware mouse input back to the game PC. PC2 also owns trigger release timing, so a jittery network can never stretch a click.

A delayed feedback loop that still feels immediate.

Running YOLO was the easy part. The hard part is that a detection is a photograph of the past: by the time a packet arrives, the commands already sent haven't shown up in the frame it describes. Command the full measured error and you apply pending movement twice - overshoot, reverse, oscillate. Command only the residual and a strafing target walks away from you - permanent trailing. Differentiate the noisy boxes to guess velocity and the aim fights itself left and right.

The controller therefore tracks four separate things and never confuses them: the measured residual (where the target was), the in-flight ledger (a 160-entry ring of every command issued, subtracted when the capturing frame can't show them yet), the remaining error (residual minus invisible commands, plus bounded horizontal lead), and a feedforward velocity learned from the target's motion. Movement is continuous velocity with acceleration and braking limits, not a restarted eased glide every tick.

// feedforward blends a fitted relative-motion regression with a
// bounded PI fallback - direct motion earns weight with speed,
// it never snaps on.
motion_weight = clamp((|v_regression| - 200) / 200, 0, 1)
feed = motion_weight × v_regression + (1 - motion_weight) × v_pi

On top of that base sit a three-sample trend-preserving stabiliser with a measured jitter band, bounded PI tracking with anti-windup, a six-point least-squares regression over real capture timestamps, a one-shot motion-confirmed acquisition boost with a hard 120 ms bound, terminal damping, and a whole-count quantization rule so the aim never strands itself almost one mouse count off centre. Lead is horizontal-only, deliberately - vertical lead earned nothing and cost stability.

A complete system, not a detector demo.

Four subsystems, each independently testable, each with its own failure handling.

Motion
  • Four aim profiles - Custom, Closet, Legit, Rage; each a different contract on speed, smoothing, filtering and tracking depth
  • 250 Hz continuous controller - velocity carried across ticks, acceleration slew limits, braking from remaining room
  • In-flight compensation - timestamped command ring subtracts what the frame can't show yet, with an 8 ms visibility margin applied consistently
  • Output chunking - one tick's correction split into paced micro-movements that sum exactly to the command
  • Configurable humanization - smoothness, jitter, randomized acquisition delay
Trigger
  • Randomized windows - reaction delay, hold duration, and shot interval all drawn from ranges
  • Movement gate - WASD-aware, opposing keys count as stationary, configurable settle delay
  • Detector-loss grace - an armed shot survives a brief tracking dropout
  • Weapon presets - Operator, Marshal, Outlaw, Vandal timings out of the box
  • Split click ownership - PC1 decides when a shot is justified, PC2 decides when the press ends, so network jitter can't stretch a click
Operations
  • Match Mode - one keypress suppresses the panel, diagnostics, and idle traffic; adaptive keepalives keep the link paired
  • Panic latch - a second key clears measurement, cancels any injected press, and stops correction until deliberately released
  • Self-pairing link - PC2 keepalives establish the UDP flow; no fixed addresses to configure
  • Version-tolerant protocol - three packet layouts accepted, legacy 9- and 11-byte formats still decode
Interface
  • 37-control web panel - every setting on both machines from one page, persisted live
  • Live detection preview - model input, crosshair, FOV ring, boxes, confidence, selected-target highlight
  • Real telemetry - frame rate, inference timings, packet and shot counters, link state
  • Responsive - desktop, tablet and 375 px mobile layouts, reduced-motion aware
  • Demand-gated preview - the expensive preview path only runs while someone is actually watching

Every mechanism here killed a real bug.

The in-flight ledger exists because reapplying pending movement caused overshoot-and-correct cycles that looked fine in ideal simulation and fell apart on real detections. Direct full-error snapping was removed for the same reason - the fastest correction is not the stable one. Rage's noise band is capped at 8 px because a 40 px adaptive deadband once decided an 11.8 px miss was "close enough" and stopped correcting for over a second and a half. Target association lives on one machine only because a second lock on PC2 could freeze a valid long flick behind its own jump guard.

Velocity prediction was replaced, not tuned. Differentiating raw boxes amplified detector noise into false lead and direction fighting; the fix was bounded PI learning as the stable floor, with the six-point regression blended in only once it's confident. Click release moved to PC2 because a delayed release packet over WiFi could stretch a 40 ms hold. Serial pacing uses absolute deadlines with a 0.2 ms spin tail because a longer busy-wait held the GIL and starved the receive thread - the visible symptom was "detection lags while the key is held," and the fix was in a sleep function.

Tested like infrastructure, not like a script.

The controller is testable without hardware - a fake target and explicit timestamp injection make the whole loop a deterministic regression harness. The suite encodes behavioural bounds, not vibes: stop overshoot within 3 px at 200 px/s and 20 px at 600 px/s, strafe-tracking tail error capped, reversal recovery bounded, both directions, noisy stops, early stops, long-flick stalls.

Current standing: 39/39 Python tests covering the control law, packet layouts, profiles, and trigger timing; 2/2 native CTest suites for the target tracker and trigger state machine; browser automation driving all 37 panel controls, saving, toggles, and the mobile layout; and replay tools that re-run estimator variants against a preserved 41-second, 9,215-row hardware trace recorded from real play. That trace is also the honest limit of the claims: simulation validates internal behaviour under its stated plant, and pixels-per-count calibration is still an assumption awaiting a fresh controlled measurement. The bounds in the test suite are the promise - nothing stronger is claimed.

"The hardest part was never running the model. It was making a delayed, noisy feedback loop feel immediate without becoming unstable - and knowing which failures were the estimator's fault and which were the network's."

Where it goes.

The build is finished for its intended scope and in daily use. The capture path is deliberately undocumented here and the source stays private. What carries forward publicly is the control-system work - the in-flight ledger, the regression/PI blend, the quantization-aware terminal handling - which feeds directly into the universal cross-game vision engine on the roadmap.

If you're working on real-time control under delayed measurement, or distributed vision systems where bandwidth is the constraint, reach me on Discord - this is the kind of problem I like.

↑↓ navigate · ↵ selectGlobality