Skip to content

Commit

Permalink
experimentation with debugdump (#383)
Browse files Browse the repository at this point in the history
# Objective

- I appreciate graphs from [`bevy_mod_debugdump`](https://github.com/jakobhellermann/bevy_mod_debugdump), this PR merely starts a discussion on adding some "first party" interest to such graphs.
- it can be useful to compare with bevy_rapier: dimforge/bevy_rapier#576

## Solution

- Add an example to generate those

Run with: `cargo run --example debugdump_3d > avian.dot  && dot -Tsvg avian.dot > avian.svg`

## Output for 3d

<details><summary>PhysicsSchedule</summary>
<p>

![dump_physics](https://github.com/user-attachments/assets/0ac6d299-0cb2-4f1f-987a-763afcc2f57c)

</p>
</details> 

<details><summary>SubstepSchedule</summary>
<p>

![dump_substeps](https://github.com/user-attachments/assets/189a1141-95d8-459f-8d28-a4807f38ed4e)

</p>
</details> 

<details><summary>FixedPostUpdate</summary>
<p>

![dump_fixed_update](https://github.com/user-attachments/assets/12488f54-932a-494c-a90b-929320c363aa)

</p>
</details> 


<details><summary>Update</summary>
<p>

![dump_update](https://github.com/user-attachments/assets/051a4d79-a626-4a3c-905d-084d16afd798)

</p>
</details> 

---

## Changelog

- Add an example to generate systems ordering graphs.

---------

Co-authored-by: Joona Aalto <[email protected]>
  • Loading branch information
Vrixyz and Jondolf authored Sep 20, 2024
1 parent a5616dd commit 7d79ca1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 3 deletions.
5 changes: 5 additions & 0 deletions crates/avian2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ bevy_math = { version = "0.14", features = ["approx"] }
approx = "0.5"
criterion = { version = "0.5", features = ["html_reports"] }
insta = "1.0"
bevy_mod_debugdump = "0.11"

[[example]]
name = "dynamic_character_2d"
Expand Down Expand Up @@ -117,6 +118,10 @@ required-features = ["2d", "default-collider"]
name = "revolute_joint_2d"
required-features = ["2d", "default-collider"]

[[example]]
name = "debugdump_2d"
required-features = ["2d"]

[[bench]]
name = "pyramid"
required-features = ["2d", "default-collider"]
Expand Down
18 changes: 18 additions & 0 deletions crates/avian2d/examples/debugdump_2d.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Run with:
//! `cargo run --example debugdump_2d > dump.dot && dot -Tsvg dump.dot > dump.svg`

use avian2d::prelude::*;
use bevy::prelude::*;

fn main() {
let mut app = App::new();

app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()));

// Schedules of interest:
// - PhysicsSchedule
// - SubstepSchedule
// - FixedPostUpdate
// - Update
bevy_mod_debugdump::print_schedule_graph(&mut app, PhysicsSchedule);
}
6 changes: 5 additions & 1 deletion crates/avian3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bevy_math = { version = "0.14", features = ["approx"] }
approx = "0.5"
criterion = { version = "0.5", features = ["html_reports"] }
insta = "1.0"

bevy_mod_debugdump = "0.11"

[[example]]
name = "dynamic_character_3d"
Expand Down Expand Up @@ -136,6 +136,10 @@ required-features = ["3d", "default-collider", "bevy_scene"]
name = "collider_constructors"
required-features = ["3d", "default-collider", "bevy_scene"]

[[example]]
name = "debugdump_3d"
required-features = ["3d"]

[[bench]]
name = "cubes"
required-features = ["3d", "default-collider"]
Expand Down
19 changes: 19 additions & 0 deletions crates/avian3d/examples/debugdump_3d.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! Run with:
//! `cargo run --example debugdump_3d > dump.dot && dot -Tsvg dump.dot > dump.svg`

use avian3d::debug_render::PhysicsDebugPlugin;
use avian3d::prelude::*;
use bevy::prelude::*;

fn main() {
let mut app = App::new();

app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()));

// Schedules of interest:
// - PhysicsSchedule
// - SubstepSchedule
// - FixedPostUpdate
// - Update
bevy_mod_debugdump::print_schedule_graph(&mut app, PhysicsSchedule);
}
2 changes: 1 addition & 1 deletion crates/examples_common_2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ bevy = { version = "0.14", default-features = false, features = [
"ktx2",
"zstd",
"bevy_winit",
"x11", # github actions runners don't have libxkbcommon installed, so can't use wayland
"x11", # github actions runners don't have libxkbcommon installed, so can't use wayland
] }
avian2d = { path = "../avian2d", default-features = false }
2 changes: 1 addition & 1 deletion crates/examples_common_3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ bevy = { version = "0.14", default-features = false, features = [
"png",
"zstd",
"bevy_winit",
"x11", # github actions runners don't have libxkbcommon installed, so can't use wayland
"x11", # github actions runners don't have libxkbcommon installed, so can't use wayland
] }
avian3d = { path = "../avian3d", default-features = false }

0 comments on commit 7d79ca1

Please sign in to comment.