Revy 是一个为 Bevy 游戏引擎设计的概念验证时间旅行调试器,基于 Rerun 构建。
Revy 的主要用途是调查游戏玩法、物理引擎或一般行为方面的bug。 Revy 不是图形调试器:如需图形调试,可以使用类似 RenderDoc 的工具。 它也不是性能分析器:Bevy 已经很好地集成了如 Tracy 等性能分析工具。
Revy 的工作原理是每帧对 Bevy 数据库的差异进行快照,然后将这些差异记录到 Rerun 数据库中。 这使你能够在任何时间点检查和可视化引擎的状态,无论是实时还是事后。 这些记录可以被分享以便重播,或者附加到bug报告中。
https://github.com/rerun-io/revy/assets/2910679/cd096cbe-5e68-4acf-8010-e6c32c5568dc
| 弹球游戏 | 3D 形状 | 外星蛋糕成瘾 |
|---|---|---|
| 在线演示 | 在线演示 | 在线演示 |
| <picture> <img src="https://yellow-cdn.veclightyear.com/835a84d5/c50848a7-beff-4cad-8b52-dda7cd4ef899.png" alt=""> <source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_breakout_title/a853af41115505212296813a0bef2373b105757b/480w.png"> <source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_breakout_title/a853af41115505212296813a0bef2373b105757b/768w.png"> <source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_breakout_title/a853af41115505212296813a0bef2373b105757b/1024w.png"> <source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_breakout_title/a853af41115505212296813a0bef2373b105757b/1200w.png"> </picture> | <picture> <img src="https://yellow-cdn.veclightyear.com/835a84d5/2b5e5207-4e45-4bfc-953f-e130c98d1b9c.png" alt=""> <source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_3dshapes_title/964446d03f1792b60e394e8c495e6fe16273939a/480w.png"> <source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_3dshapes_title/964446d03f1792b60e394e8c495e6fe16273939a/768w.png"> <source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_3dshapes_title/964446d03f1792b60e394e8c495e6fe16273939a/1024w.png"> <source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_3dshapes_title/964446d03f1792b60e394e8c495e6fe16273939a/1200w.png"> </picture> | <picture> <img src="https://yellow-cdn.veclightyear.com/835a84d5/ed7999de-f625-4095-9a09-65b9009f12e8.png" alt=""> <source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_alien_title/3e4ba4f3cfb728942ecb38ba3e613f3498dda3e2/480w.png"> <source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_alien_title/3e4ba4f3cfb728942ecb38ba3e613f3498dda3e2/768w.png"> <source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_alien_title/3e4ba4f3cfb728942ecb38ba3e613f3498dda3e2/1024w.png"> <source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_alien_title/3e4ba4f3cfb728942ecb38ba3e613f3498dda3e2/1200w.png"> </picture> |
:warning: 这不是 Rerun 的官方项目。这是一个旁支实验,旨在探索像 Rerun 这样的工具在游戏开发中可能带来的可能性。它并不是一个全面的、得到适当维护的项目——也不打算成为这样的项目。它可能在许多方面存在错误和运行缓慢的问题,而且肯定充满了代码上的不完美之处 :upside_down_face: 。
安装 Rerun 查看器(0.16版本)。
在你的依赖项中添加 revy:
revy = "0.16" # 版本始终与 rerun 版本匹配
初始化 rerun 插件:
.add_plugins({ let rec = revy::RecordingStreamBuilder::new("<你的应用名称>").spawn().unwrap(); revy::RerunPlugin { rec } })
这将在后台启动一个 Rerun 查看器,并将记录数据流传输到其中。
查看 RecordingStreamBuilder 文档了解其他选项(保存到文件、连接到远程查看器等)。
Revy 将记录每个实体的所有组件,要么使用内置的专用日志记录器之一,要么使用基于反射的通用日志记录器。
你还可以通过插入 RerunComponentLoggers 资源来注册自己的自定义日志记录器:
.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) }, )), ), ]))
| Bevy | Revy | Rerun |
|---|---|---|
| 0.13 | 0.14 | 0.14 |
| 0.13 | 0.15 | 0.15 |
| 0.13 | 0.16 | 0.16 |