Repository navigation
3D view: no rendering for unwatched cameras, frame pacing, hidden window (latency step 5) - #125
Merged
Merged
Conversation
Step 5 (first part) of plans/battlefield-latency.md (issue #95). - A drone's camera that nobody watches, and a battlefield that no app asks for, no longer render (Camera::is_active). Each camera costs its own shadows, sky and exposure whatever its size: the six idle drone cameras at 64 by 36 took the view from 72 to 185 ms a frame. - Frame pacing (visualization_battlefield::pacing): after each frame the render thread waits for the GPU to finish the frame two before. The view presents no window, so nothing held the CPU back: the GPU ran 13 frames (730 ms) behind for the whole game. Now 224 ms, and the valley loads in 25 s instead of 35 s. Unit tests first: render_size for the drones' cameras and the battlefield, and the pacer. Measured with towers_view alone and a client that pans like the app; in a game the app still draws about 5 times a second, mostly because the 3D view's window covers it (results file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts draw rate Step 5 (second part) of plans/battlefield-latency.md (issue #95). - towers_view --hidden keeps its window off screen; the commander app starts it so (server::view_args). The cameras draw into images either way. Unit tests first for both. - The app logs how many times a second it draws, every 5 s. The results file corrects the app's earlier numbers: they came from forced draws of a window that is not on screen in a test run, so they do not describe what a person at the app sees. The 3D view's own numbers stand. Next is a measurement with the app on a screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 5 of
plans/battlefield-latency.md(#95). Stacked on #124. Measurements are inplans/battlefield-latency-results.md.Changes
Camera::is_active = falseinstead of rendering at 64 × 36. Each camera pays its own shadows, sky and exposure whatever its size. Six idle drone cameras took the 3D view from 72 to 185 ms a frame.visualization_battlefield::pacing). After each frame the render thread waits for the GPU to finish the frame two before, for at most 500 ms. Bevy presents a window only when a camera draws into it, andtowers_viewdraws into images, so nothing held the CPU back. It queued frames while the valley loaded, and the GPU stayed 13 frames (about 730 ms) behind for the rest of the game.wgpu30 is added tovisualization_battlefield, only forSubmissionIndex. It is the version Bevy uses, so the build still has one wgpu.Measured (towers_view alone, with a client that pans like the app)
In a game, in the app: not measured yet
Correction (second commit). An earlier version of this description said the app still draws about 5 times a second in a game, mostly because the 3D view's window covers it. That is not supported. Those numbers came from the test driver forcing draws of the app's window. In a test run, or when the app is started from a shell session, that window is not on screen, and macOS does not draw it. In a 4-minute practice game started that way, the app never once logged a draw rate.
The 3D view's own numbers above do not depend on the app's window, and stand.
The second commit:
towers_view --hidden. The view keeps its window off screen, and the commander app starts it so. The view's cameras draw into images either way.battlefield: the app draws N times a second, every 5 s.Next: measure with the app on a screen, with a person panning the camera.
Tests
render_sizefor the drones' cameras and the battlefield, the pacer, the hidden window, and the app's arguments to the view.visualization_battlefield10 passed,recreation_towers_view6 passed,teleoperation_command1 new.cargo clippyon both crates: clean.cargo fmt: done.--selftest. The sim's window presents, so it has its own pacing, and nothing here touches the flight model.🤖 Generated with Claude Code