Skip to content

Battlefield: each picture goes out with its own camera, and no gate (latency step 1) - #124

Merged
ptescher merged 2 commits into
masterfrom
battlefield-latency-1
Nov 13, 2026
Merged

ptescher merged 2 commits into
masterfrom
battlefield-latency-1

Conversation

@ptescher

Copy link
Copy Markdown
Owner

Step 1 of plans/battlefield-latency.md (#95): each picture of the battlefield now goes out with the camera it was rendered from, and the stillness gate is gone. Results are in plans/battlefield-latency-results.md.

Change

  • One readback per frame. Each frame the 3D view spawns a ReadbackOnce, and its observer keeps the request that frame was rendered for. Bevy 0.20 extracts the readback with that frame and copies the texture after the frame's render graph, so the pairing is exact. The observer despawns the entity, because Bevy only removes the components.
  • steady_request is gone (it sent a picture only after four still frames). visualization_battlefield::outbox::Outbox decides what goes out: the size asked for, not older than a picture already sent, and at most 60 a second.
  • The driver times each draw of the window during the pan, and prints it with the measurement.

Evidence

  • Unit tests: Outbox has 6 tests, written first. They failed to compile without it, and pass now. They replace the old steady_request test.

  • Alignment while moving: screenshots taken in the middle of a pan show the map on the valley (the towers' circles in their clearings, the lake's shore). That is the slide the gate was added for, in be3b8be.

  • A 3 s pan:

    Before After
    New pictures a second 0.3 14 to 23
    Picture out of date by (median) 544 ms 420 to 630 ms

Found: the commander app draws about 5 times a second while the 3D view runs

The draw The round trip Draws in 3.6 s
3D view running 15 ms 140 to 200 ms 11 to 14
No 3D view 2 ms 6 ms 140

GPUI waits in next_drawable() while the 3D view, at about 100 ms a frame, keeps the shared GPU busy. The drones' cameras are not the cost: not watching them changed nothing. So the expectation «The picture keeps up with the camera» stays Status: pending, and step 5 (a lighter 3D view) is next.

Not run

--selftest and the whole workspace suite; nothing here touches the flight model. cargo clippy on the changed crate is clean, and CI runs the rest.

🤖 Generated with Claude Code

ptescher and others added 2 commits November 12, 2026 07:59
Step 1 of plans/battlefield-latency.md (issue #95).

Each frame the 3D view spawns a ReadbackOnce whose observer keeps the
request the frame was rendered for: Bevy extracts the readback with that
frame and copies the texture after its render graph, so a picture's
camera is known, not guessed. steady_request (a picture only after four
still frames) is gone. visualization_battlefield::outbox decides what goes
out: the size asked for, not older than one sent, at most 60 a second.
Unit tests first (6, red without Outbox).

Screenshots in the middle of a pan show the map on the valley, which is
what the gate was there for.

A 3 s pan: 14 to 23 new pictures a second (was 0.3), but still 420 to
630 ms behind. The driver now times each draw of the window during the
pan: with the 3D view running the app draws about 5 times a second (a
15 ms draw, a 200 ms round trip; 2 ms and 6 ms with no 3D view). GPUI
waits for a drawable while the 3D view keeps the GPU busy. The
expectation stays Status: pending; step 5 (a lighter 3D view) is next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptescher
ptescher merged commit 888abfc into master Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant