revy

Crates.iorevy
lib.rsrevy
version0.20.0
sourcesrc
created_at2024-03-01 14:21:27.818794
updated_at2024-12-10 16:20:22.97678
descriptionProof-of-concept time-travel debugger for Bevy, built with Rerun.
homepagehttps://rerun.io
repositoryhttps://github.com/rerun-io/revy
max_upload_size
id1158957
size263,398
rerun.io (rerunio)

documentation

README

Revy

Latest version Documentation MIT Apache

Revy is a proof-of-concept time-travel debugger for the Bevy game engine, built using Rerun.

The general idea is that one would use Revy to investigate gameplay/physics/general-behavior-ish kinds of bugs.
Revy is not a graphics debugger: for that you'd use e.g. RenderDoc.
It is not a performance profiler either: for that, Bevy integrates well with e.g. Tracy.

Revy works by snapshotting diffs of the Bevy database every frame that are then logged into the Rerun database.
This allows you to inspect and visualize the state of the engine at any point in time, either in real-time or after the fact.
These recordings can then be shared to be replayed or e.g. attached to bug reports.

https://github.com/rerun-io/revy/assets/2910679/cd096cbe-5e68-4acf-8010-e6c32c5568dc

Examples

Breakout 3D shapes Alien Cake Addict
Live demo Live demo Live demo

⚠️ This is not an official Rerun project. This is a side-experiment meant to explore the possibilities that a tool like Rerun could open when it comes to gamedev. It is not a full-fledged, properly maintained thing -- nor does it aim to be. It's also probably buggy and slow in many ways, and it certainly is full of code abominations 🙃.

Usage

  1. Install the Rerun Viewer (0.20).

  2. Add revy to your dependencies:

    revy = "0.20"  # always matches the rerun version
    
  3. Initialize the rerun plugin:

    .add_plugins({
        let rec = revy::RecordingStreamBuilder::new("<your_app_name>").spawn().unwrap();
        revy::RerunPlugin { rec }
    })
    

    This will start a Rerun Viewer in the background and stream the recording data to it.
    Check out the RecordingStreamBuilder docs for other options (saving to file, connecting to a remote viewer, etc).

Examples

This repository comes with a number of pre-injected Bevy examples:

cargo run --example breakout
cargo run --example alien_cake_addict

Custom loggers

Revy will record every components of every single entity (), either using one of the builtin dedicated loggers, or using the generic reflection-based logger.

You can also register your own custom loggers by inserting a RerunComponentLoggers resource:

.insert_resource(revy::RerunComponentLoggers::new([
    (
        "bevy_render::view::visibility::ViewVisibility".into(),
        Some(revy::RerunLogger::new(
            |_world, _all_entities, entity, _component| {
                let suffix = None;

                use revy::external::rerun;
                let data = entity
                    .get::<ViewVisibility>()
                    .map(|vviz| {
                        revy::Aliased::<rerun::components::Text>::new(
                            "ViewVisibility",
                            rerun::components::Text(
                                if vviz.get() { ":)))" } else { ":'(" }.into(),
                            ),
                        )
                    })
                    .map(|data| Box::new(data) as _);

                (suffix, data)
            },
        )),
    ),
]))

Compatibility

Bevy Revy Rerun
0.13 0.14 0.14
0.13 0.15 0.15
0.13 0.16 0.16
0.14 0.17 0.17
0.15 0.20 0.20
Commit count: 12

cargo fmt