Repository navigation
Fix keyboard camera and minimap timing, sprite colour and scale, trail wrap, and drag-over-UI in the renderer - #101
Conversation
Five ideas from the #101, #103 and probe-script work that the October 24 review did not ledger: the predation attacker-order bias (which docs/DECISIONS.md already cites), old age never firing, SpeciesId rewritten every classification pass, the stale Killed doc comment and the audit summary crash on a missing CSV. Also records extra-tick evidence on headless-save-ticks-past-summary.
b2a106b to
1ff72d5
Compare
ReviewIndependent review by a separate Claude Opus 5.5 reviewer agent at Verified:
Findings: 3.
The same reviewer re-checked the fixes at 48f06c9 (originally Not checked: on-screen appearance, since no GUI was opened. Plugin Rebase onto origin/main 2a2dafb (from base 716d16a): the nine commits Post-rebase reviewIndependent review by a separate Claude Opus 5.5 reviewer agent at Verified: crate code is byte-identical to the pre-rebase head; with Findings: 2.
Not checked by the reviewer: on-screen behaviour (no GUI opened). GUI validation (coordinator, release build at 1ff72d5's code)A scripted tour ( Not yet checked by hand: pausing and panning with WASD, minimap Unrelated, found on the way: a tour's |
… and features docs
1ff72d5 to
cc601e3
Compare
Why
The 2026-10-09 full review found six renderer bugs, batched as the
review backlog entry
render-input-and-sprite-fixes. Each one makes theworld view misreport what the sim is doing, or react to input it should
ignore.
render-input-on-virtual-time:camera_control_systemandupdate_minimapread the defaultTime, which inUpdateisTime<Virtual>.sim_speed_systempauses and rescales that clock.So while paused, WASD, the arrows and E/Q/-/= did nothing, and the
minimap (viewport box, selection marker, mode switches) froze. At
16x, keyboard pan ran 16 times faster. Pausing to look around is one
of the main ways to watch the sim, and that was exactly when the
keyboard camera stopped working.
sprite-colour-frozen-at-spawn-species: a simple-LOD sprite's colourcame from the organism's species when the sprite was built and never
changed after that. Founders spawn in species 0 before the first
classification pass, so every founder kept species 0's colour, and
an organism moved to another species kept its old one. This lasted
until the next LOD switch rebuilt the sprites, so at a steady zoom a
new species was invisible on screen until its children appeared.
trail-draws-across-torus-wrap: the selected organism's trail was asingle line strip. When the organism wrapped across a world edge, the
strip drew a line across the whole map.
minimap-row-underflow-at-world-edge: the minimap's normal and rangemodes computed a dot's row as
size - 1 - (y / world_h * size) as usize. That underflows wheny == world_h, whichrem_euclidcanproduce for a tiny negative input. A debug build panics there. A
release build wraps the value and the bounds check throws the dot
away.
simple-lod-spawn-scale-overwritten: a new simple-LOD sprite spawnedat
body_size * 1.5for plants or* 2.0for everything else. Onthe next frame the per-frame update replaced that with
organism_sprite_scale, which includes the energy factor. So theplant multiplier did nothing, and every new sprite changed size after
one frame. Detailed sprites had the same one-frame jump, because
their spawn scale left out energy and flash.
drag-pan-ignores-pointer-over-ui: scroll zoom and click-selectalready stand down while the pointer is over egui, but mouse-drag
panning did not. A right-, middle- or Shift+left-drag that started
on the side panel or the minimap panned the world underneath it.
What changed
camera_control_system, and the repainttimer in
update_minimap, now readTime<Real>. They run at thesame on-screen rate whether the sim is paused or at any speed.
Time<Real>has no maximum delta, unlike the sim'sTime<Virtual>(capped at 100 ms by the sim plugin), so the camera's step is capped
at
CAMERA_MAX_DT_SECS(0.1 s), the same figure.Without the cap, a slow frame with a pan or zoom key held would jump
the camera or snap the zoom to its clamp. Mouse drag and scroll never
used a delta, so they are unchanged.
simple_sprite_color. A new PostUpdate system,recolour_sprites_on_species_change, runs aftersync_organism_transforms. For every simple-LOD sprite withChanged<SpeciesId>, it rewrites the sprite's material colour. Thespecies classifier writes every organism's id on each pass, even when
the id stays the same (the TODO
species-id-rewritten-every-passtracks that), so the system compares colours first and only calls
get_mut(which re-uploads the material) when the colour actuallychanged. Detailed-LOD parts are coloured by segment type,
not species, so they are left alone.
draw_trails_systemsplits the trail into runs withtrail_runs. Arun ends wherever two consecutive samples are more than half the
world apart on either axis. Each run with at least two points is
drawn as its own line strip.
minimap_pxcomputes a minimap pixel with signed arithmetic, the waythe selection-marker code already did.
minimap_dotreturns thatpixel as image indices, or
Noneif it falls outside the image. Thenormal-mode dots, range-mode grey dots, range-mode highlight and
selection marker all go through these two functions.
current_sprite_scalecomputesorganism_sprite_scalewith theenergy factor and flash pulse applied. The spawn and the per-frame
update now both use it, so a sprite keeps its size from its first
frame. The plant-only 1.5 spawn multiplier is gone. It only ever
lasted one frame, so the steady-state sizes on screen are unchanged.
To provide those inputs at spawn, the without-sprite query now also
reads
Energy,BodySizeandActionFlash. The with-sprite updatequery already required all three.
CameraDragStatenow holds aDragPhase(Idle,Panning,Ignored).next_drag_phasesettles each drag on the frame itsbutton goes down: if the pointer is over the UI then, the drag is
ignored until release. A drag that starts on the world keeps panning
when the pointer crosses onto a panel. A drag that starts on a panel
stays ignored when the pointer moves onto the world. The cursor
position is now tracked in every phase, and the first pan delta is
measured from the last cursor sample before the press frame. Before,
the drag skipped its first cursor sample.
last_posis anOption,so the first cursor event ever seen cannot produce a jump from the
origin.
docs/DECISIONS.mdnow notesthat the keyboard camera and the minimap repaint read
Time<Real>.The pan/zoom/drag line in
docs/FEATURES.mdnow says keyboard panand zoom work while paused, and that a drag starting over the side
panel or minimap is ignored.
render-input-and-sprite-fixesentry is removed fromreview/BACKLOG.md. No other entry'sRelated:line named it. Therelated
lod-switch-skips-childless-spritesTODO is out of scope anduntouched.
Markers
Type: fix
Resolves review backlog: render-input-and-sprite-fixes
Resolves review finding: render-input-on-virtual-time
Resolves review finding: sprite-colour-frozen-at-spawn-species
Resolves review finding: trail-draws-across-torus-wrap
Resolves review finding: minimap-row-underflow-at-world-edge
Resolves review finding: simple-lod-spawn-scale-overwritten
Resolves review finding: drag-pan-ignores-pointer-over-ui
Validation
All scenarios use
cargo run --release -- --seed 42, which opens awindow, and start at the default zoom (1.0, the simple LOD).
(
render-input-on-virtual-time). Press Space to pause. Hold D, thenthe arrow keys, then Q and E. Before the fix nothing moved while
paused; now the camera pans and zooms. While still paused, pan with
WASD and watch the minimap in the top-left. Before, its yellow
viewport box stayed where it was when you paused; now it follows
the camera within half a second. Press M while paused: the minimap
should switch to the heatmap within half a second (before, it stayed
on the old mode until you unpaused). Then unpause, press
]fourtimes to reach 16x and hold D. The pan speed should match 1x;
before, it was 16 times faster.
(
sprite-colour-frozen-at-spawn-species). Do not zoom. For thefirst few seconds every consumer founder is drawn in shades of one
hue, species 0's colour shifted towards red by claw power and
towards green by photosynthesis. After the first classification
pass, at 5 s of sim time, consumers should split into several
distinct species hues without any zooming. Before the fix, they kept
the founder hue until you zoomed in past the LOD threshold and back
out. Plants stay yellow-green either way.
trail-draws-across-torus-wrap).Click near the edge of the minimap to jump to a world edge. Click an
active (outlined) organism moving towards the edge and press T. When
it crosses the edge, the old trail drew a straight line across the
whole map to the far side. Now the trail breaks at the seam: a short
piece stays at the edge it left, and a new piece starts on the
opposite side.
(
minimap-row-underflow-at-world-edge). The trigger is an organismat exactly the world's top edge, which is too rare to stage by hand,
so check it by inspection. Run
grep -n "size - 1 -" crates/clauvolution_render/src/lib.rs. Theonly hits should be the two terrain loops'
size - 1 - py, whichare safe because
py < size. Every minimap dot and marker goesthrough
minimap_pxorminimap_dot, andcargo test -p clauvolution_render minimap_dotcovers the edgeitself. As a regression check in the GUI, the minimap's dots should
still sit where the organisms are in Normal mode. Press M twice for
Range mode with an organism selected: its species should still be
highlighted in the right places, and the selection crosshair should
still sit on the selected organism.
simple-lod-spawn-scale-overwritten). Theold bug lasted a single frame, so it is hard to see by eye. Watch
newborns at the default zoom: a new sprite should appear at its
final size, without a one-frame pop. The steady-state sizes of
plants and consumers should look the same as before the fix, since
the formula the per-frame update applies has not changed. The test
new_sprites_keep_their_spawn_scale(run it withcargo test -p clauvolution_render new_sprites) checks that theframe-one and frame-two scales match at both LODs for plants and
consumers.
(
drag-pan-ignores-pointer-over-ui). Press the right mouse buttonover the side panel and drag onto the world. Before the fix, the
world panned. Now nothing moves until you release, and pressing
again over the world pans as usual. Do the same starting on the
minimap image: no pan. Then start a right-drag on the world and drag
across onto the side panel. It should keep panning, since the drag
started over the world.
Automated:
bash scripts/check.shpasses (queues, links, fmt, clippy,all workspace tests),
cargo test -p clauvolution_renderpasses, andcargo run --release -q -- --headless 300 --seed 42runs clean. Theheadless run does not exercise render code; it only guards the build.
New unit tests in
clauvolution_rendercover each fix. Each wasmutation-checked by putting the old code back and confirming the test
fails:
keyboard_pan_and_zoom_run_on_real_time_while_pausedandminimap_repaints_on_real_time_while_pausedfail withRes<Time>.a_slow_frame_moves_the_keyboard_camera_at_most_one_capped_stepfails with the delta cap removed.
simple_sprite_recolours_when_its_species_changesfails with therecolour loop emptied.
trail_breaks_where_it_wraps_on_either_axisfails with no split, andalso with an x-only split.
minimap_dot_maps_corners_and_drops_the_far_edgespanics with"attempt to subtract with overflow" under the old
usizearithmetic.new_sprites_keep_their_spawn_scalefails with the old spawn scale,for simple and detailed LODs, plant and consumer.
drag_phase_is_decided_when_the_button_goes_downanddrag_started_over_the_ui_does_not_panfail with the UI gateremoved.