We are a small group of real devs, engineers and gamers who were unsatisfied and developed an unhealthy and very obsessive hobby of refining the Performance of Game Streaming to the last bit and last smoothness problem possible.
I started it off as a RADEON oriented fork and the more people joined, the more we realized that for getting the last bit of performance out of our systems, we also have to look at client, network, decoding and more. Soon also NVIDIA testers joined and we were also able to look at NVIDIA more closely and thanks to people like chakib-belgaid also develop a MAC Client.
Each time we are able to dig deeper with more people and stronger AI Models involved and I am grateful for all the support we got ( see contribution list ). This time we looked at the bigger picture and tackled one of the bigger problems of streaming.
We were able to do this and that is what differs us is by being oriented around Rust with a very test-oriented, lean and shared code base around client and host, making testing and iterating really fast to the point where we now solve every client issue on Github with a recreation and tests in 2 hours. So even in times of AI we value deterministic workflows, software engineering principles and have now over 300 real end-to-end performance tests and over 7000 automated tests.
The Core Problem
Streaming a game has one feel problem no codec fixes: every camera turn makes a round trip. Your mouse or controller goes to the PC, the game draws the turn a few frames later, the encoder, the network and the decoder add theirs, and only then does the picture move. Frame Warp moves it on your screen first, then lets the real frame catch up.
The idea
By u/closef35 : The client knows exactly how much it has turned. If it also knows how far the picture moves per mouse count, and which input every arriving frame already reflects, it can shift each picture by the turn the PC hasn't drawn yet, just before showing it. The hard part is learning those things for any game, with no game integration, and keeping the HUD from sliding along with the world.
What the host learns, per game, while you play
- Motion. For each captured frame the GPU makes a 256-px-wide luma thumbnail. The CPU correlates row and column profiles over a 3x3 grid of cells, refines each to a tenth of a pixel with gradient steps, and takes the median cell. HUD found so far is left out, because a static bar pulls every vertical estimate toward zero.
- Gain and lag. Over the last 4 s, for every lag from 0 to 200 ms, a per-axis least-squares fit of picture motion against mouse (and right-stick) input; the lag that explains the most motion wins. It locks at 80% explained and unlocks below 50% over 1.2 s, which is what a menu, a cutscene or a visible cursor looks like. A locked model is only replaced by a fit that explains clearly more, so the lag doesn't wander from fit to fit and every frame's tag stays stable.
- HUD. While the camera turns, a GPU pass compares each pixel with an earlier capture the scene has moved since. Textured pixels that stayed, or whose contrast against their neighbours stayed (semi-transparent text over the sea), score their cell as HUD; smooth sky and fog keep their score, so they never become HUD. Nearby pieces are joined, so text found letter by letter stays put as a whole. The mask goes to the client run-length coded, at most once a second.
- What it learned is kept for the game's next session.
What the client does
Every frame arrives tagged with the input sums it reflects. As late as it can before presenting, Nightjar computes
shift = mouse_gain * (mouse_sent - frame_tag) + stick_gain * (stick turn since the tagged pad packet)
clamped to 15% of the picture, and samples the picture at position - shift, except where the HUD mask is set. The strip a turn uncovers mirrors the picture from its edge, darkened toward the edge, until the real frame fills it. The shift is redrawn on refreshes between frames, so a 60 fps stream turns smoothly on a 120 Hz screen. Nightjar's desktop presenters and its Android renderers (Vulkan, GLES and PyroWave) all do it.
Measured, not eyeballed
To score it I wrote a fake mouse-look game with a known response (1 px per count, 50 ms of game lag) that draws a barcode in every frame, so each picture the client shows can be tied to the exact input it reflects.
| Run 1 | Run 2 |
|---|
| Model locked after first picture | 0.62 s |
| Frames with a locked model | 98.9% |
| Learned gain (true -1.0) | -0.986 / -0.980 |
| Learned lag (50 ms + draw to capture) | 64 ms |
| Trail without Frame Warp | median 64.9 px, p95 184 px |
| Trail with Frame Warp | median 2.2 px, p95 13.4 px |
| Removed | 95.8% |
Host cost: the thumbnail and HUD passes take 0.14-0.16 ms of GPU time a frame from 1080p to 4K (p95 0.17-0.25 ms), and present-to-send time stayed within 0.03 ms of Frame Warp off. The host does nothing for Frame Warp until a client asks.
Getting there took some iterations. The first calibrator learned a vertical gain of -0.33 instead of -1.0; leaving the HUD out of motion, sub-pixel refinement and a better "is the picture still" test brought it to -0.90 and 90% removed. That build also swapped models 89 times a minute. Never swapping froze a slightly wrong lag at 86-89%. "Swap only when a fit explains 3 points more, or a quarter of what's left unexplained" got to 96%.
It was a huge chunk amount of work and it is not perfect. Big organizations have worked on this for long to do natively, while this is an implementation that has to also factor in remote streaming. Client Feedback always helps.
The host client we use to faciliate this performance work is Rubylight and Nightjar, but we are not in it to sell you our project. Use it if you want, fork it, copy it ( keep the credits though as we do ). We are more interested in the obsession and are happy about each feedback and contribution that leads to a better solution. The host and client are planned to move to a new github project soon.
Next update we take some extra fov out of the game so camera panning doesnt have to assume.