bevy/examples/games
Rob Parrett 424e563184
Make contributors example deterministic in CI (#15901)
# Objective

- Make the example deterministic when run with CI, so that the
[screenshot
comparison](https://thebevyflock.github.io/bevy-example-runner/) is
stable
- Preserve the "truly random on each run" behavior so that every page
load in the example showcase shows a different contributor first

## Solution

- Fall back to the static default contributor list in CI
- Store contributors in a `Vec` so that we can show repeats of the
fallback contributor list, giving the appearance of lots of overlapping
contributors in CI
- Use a shared seeded RNG throughout the app
- Give contributor birds a `z` value so that their depth is stable
- Remove the shuffle, which was redundant because contributors are first
collected into a hashmap
- `chain` the systems so that the physics is deterministic from run to
run

## Testing

```bash
echo '(setup: (fixed_frame_time: Some(0.05)), events: [(100, Screenshot), (500, AppExit)])' > config.ron
CI_TESTING_CONFIG=config.ron cargo run --example contributors --features=bevy_ci_testing
mv screenshot-100.png screenshot-100-a.png
CI_TESTING_CONFIG=config.ron cargo run --example contributors --features=bevy_ci_testing
diff screenshot-100.png screenshot-100-a.png
```

## Alternatives

I'd also be fine with removing this example from the list of examples
that gets screenshot-tested in CI. Coverage from other 2d examples is
probably adequate.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-10-15 18:32:51 +00:00
..
alien_cake_addict.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
breakout.rs Text Rework cleanup (#15887) 2024-10-15 02:32:34 +00:00
contributors.rs Make contributors example deterministic in CI (#15901) 2024-10-15 18:32:51 +00:00
desk_toy.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
game_menu.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
loading_screen.rs Remove incorrect equality comparisons for asset load error types (#15890) 2024-10-14 01:00:45 +00:00
stepping.rs Text Rework cleanup (#15887) 2024-10-15 02:32:34 +00:00