Skip to content

Commit

Permalink
wip: observer scene serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Oct 8, 2024
1 parent 2e7a807 commit af7aafe
Show file tree
Hide file tree
Showing 21 changed files with 28,195 additions and 24,762 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ opt-level = 1
opt-level = 3

[workspace.package]
version = "0.0.4-rc.2"
version = "0.0.4-rc.1"
edition = "2021"
description = "A very flexible AI behavior library for games and robotics."
documentation = "https://beetmash.com/docs/beet"
Expand Down Expand Up @@ -38,12 +38,12 @@ members = [

[workspace.dependencies]
## internal
beet = { path = "./", version = "0.0.4-rc.2" }
beet_spatial = { path = "crates/beet_spatial", version = "0.0.4-rc.2", default-features = false }
beet_flow = { path = "crates/beet_flow", version = "0.0.4-rc.2" }
beet_flow_macros = { path = "crates/beet_flow/macros", version = "0.0.4-rc.2" }
beet_ml = { path = "crates/beet_ml", version = "0.0.4-rc.2" }
beet_examples = { path = "crates/beet_examples", version = "0.0.4-rc.2" }
beet = { path = "./", version = "0.0.4-rc.1" }
beet_spatial = { path = "crates/beet_spatial", version = "0.0.4-rc.1", default-features = false }
beet_flow = { path = "crates/beet_flow", version = "0.0.4-rc.1" }
beet_flow_macros = { path = "crates/beet_flow/macros", version = "0.0.4-rc.1" }
beet_ml = { path = "crates/beet_ml", version = "0.0.4-rc.1" }
beet_examples = { path = "crates/beet_examples", version = "0.0.4-rc.1" }

## local
beetmash = { version = "0.0.6-rc.2", path = "../beetmash" }
Expand Down
2 changes: 1 addition & 1 deletion crates/beet_examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ anyhow.workspace = true

[[example]]
name = "export_scenes"
path = "./examples/export_scenes.rs"
path = "./examples/export_scenes.rs"
1 change: 1 addition & 0 deletions crates/beet_examples/src/plugins/beet_example_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub fn beet_example_plugin(app: &mut App) {
BeetDefaultPlugins,
BeetDebugPlugin,
DefaultReplicatePlugin,
temp_patches,
))
.add_plugins((plugin_spatial, plugin_2d, plugin_3d))
.register_type::<Collectable>();
Expand Down
5 changes: 1 addition & 4 deletions crates/beet_examples/src/scenes/ml/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use bevy::prelude::*;


pub fn fetch_npc(mut commands: Commands) {

let Foxie {
graph,
idle_index,
Expand All @@ -27,9 +26,7 @@ pub fn fetch_npc(mut commands: Commands) {
max_force: MaxForce(0.05),
max_speed: MaxSpeed(2.),
..default()
}
// Uncomment this to have an initial target
// Sentence::new("tasty"),
},
))
.with_children(|parent| {
let agent = parent.parent_entity();
Expand Down
3 changes: 3 additions & 0 deletions crates/beet_flow/src/action_builder/action_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use crate::prelude::*;
use bevy::prelude::*;
use bevy::utils::all_tuples;


/// Trait implemented for actions, allowing them to register their
/// components, systems and observers.
pub trait ActionBuilder: Sized {
fn build(app: &mut App, config: &BeetConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn insert_sentence_steer_target<T: GenericActionComponent>(
items: Query<Entity, With<T>>,
mut berts: ResMut<Assets<Bert>>,
) {

let (agent, target_sentence, handle, _) = query
.get(trigger.entity())
.expect(expect_action::ACTION_QUERY_MISSING);
Expand Down
8 changes: 0 additions & 8 deletions examples/export_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use beet_examples::prelude::*;
use beetmash::prelude::*;
use bevy::prelude::*;

const DIR: &str = "scenes";

fn plugin(app: &mut App) {
app.add_plugins((MostDefaultPlugins, beet_example_plugin));
}
Expand All @@ -23,16 +21,12 @@ fn main() -> Result<()> {

SceneGroupExporter::new(plugin)
.with_config(config.clone())
.with_dir(DIR)
.with_filter::<DefaultSceneExportFilter>()
.add_scene("beet-debug", beet_examples::scenes::flow::beet_debug)
.add_scene("hello-world", beet_examples::scenes::flow::hello_world)
.export()?;

SceneGroupExporter::new(plugin)
.with_config(config.clone())
.with_dir(DIR)
.with_filter::<DefaultSceneExportFilter>()
.without_clear_target()
.add_scene("seek", beet_examples::scenes::spatial::seek)
.add_scene("flock", beet_examples::scenes::spatial::flock)
Expand All @@ -46,9 +40,7 @@ fn main() -> Result<()> {

SceneGroupExporter::new((plugin, plugin_ml))
.with_config(config.clone())
.with_dir(DIR)
.without_clear_target()
.with_filter::<DefaultSceneExportFilter>()
.add_scene("hello-ml", beet_examples::scenes::ml::hello_ml)
.add_scene("fetch-scene", beet_examples::scenes::ml::fetch_scene)
.add_scene("fetch-npc", beet_examples::scenes::ml::fetch_npc)
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub fn main() {
.add_systems(
Startup,
(
beet_examples::scenes::flow::beet_debug,
beetmash::core::scenes::camera_2d,
beetmash::core::scenes::ui_terminal,
beet_examples::scenes::flow::beet_debug,
beet_examples::scenes::flow::hello_world,
),
)
Expand Down
92 changes: 89 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ cmd *args:

export-scenes *args:
cargo run --example export_scenes {{args}}

app *args:
cargo run --example app_full {{args}}
cargo run --example app {{args}}

# blocked on #https://github.com/bevyengine/bevy/issues/14300
hello-world:
cargo run --example app \
just app \
./scenes/beet-debug.json \
../beetmash/scenes/camera-2d.json \
../beetmash/scenes/ui-terminal-input.json \
Expand All @@ -44,6 +45,9 @@ test-ecs *args:
test-ml *args:
just watch 'cargo test -p beet_ml --lib -- {{args}}'

test-examples *args:
just watch 'cargo test -p beet_examples --lib -- {{args}}'

run crate example *args:
cargo run -p {{crate}} --example {{example}} {{args}}

Expand Down Expand Up @@ -214,4 +218,86 @@ pull-assets:
view-cors:
gcloud storage buckets describe gs://beet-examples --format="default(cors_config)"
update-cors:
gcloud storage buckets update gs://beet-examples --cors-file=cors.json
gcloud storage buckets update gs://beet-examples --cors-file=cors.json















### TEST SCENE LOADS

test-fetch:
cargo run --example app_ml \
../beetmash/scenes/ui-terminal-input.json \
../beetmash/scenes/lighting-3d.json \
../beetmash/scenes/ground-3d.json \
./scenes/beet-debug.json \
./scenes/fetch-scene.json \
./scenes/fetch-npc.json \


test-flock:
cargo run --example app \
../beetmash/scenes/camera-2d.json \
../beetmash/scenes/space-scene.json \
./scenes/beet-debug.json \
./scenes/flock.json \

test-seek:
cargo run --example app \
../beetmash/scenes/camera-2d.json \
../beetmash/scenes/space-scene.json \
./scenes/beet-debug.json \
./scenes/seek.json \

test-frozen-lake-train:
cargo run --example app_ml \
../beetmash/scenes/lighting-3d.json \
./scenes/frozen-lake-scene.json \
./scenes/frozen-lake-train.json \

test-frozen-lake-run:
cargo run --example app_ml \
../beetmash/scenes/lighting-3d.json \
./scenes/frozen-lake-scene.json \
./scenes/frozen-lake-run.json \

test-hello-animation:
cargo run --example app \
../beetmash/scenes/ui-terminal.json \
../beetmash/scenes/lighting-3d.json \
../beetmash/scenes/ground-3d.json \
./scenes/beet-debug.json \
./scenes/hello-animation.json \

test-hello-ml:
cargo run --example app_ml \
../beetmash/scenes/camera-2d.json \
../beetmash/scenes/ui-terminal-input.json \
./scenes/beet-debug.json \
./scenes/hello-ml.json \

test-hello-world:
cargo run --example app \
../beetmash/scenes/camera-2d.json \
../beetmash/scenes/ui-terminal.json \
./scenes/beet-debug.json \
./scenes/hello-world.json \

test-seek-3d:
cargo run --example app \
../beetmash/scenes/ui-terminal.json \
../beetmash/scenes/lighting-3d.json \
../beetmash/scenes/ground-3d.json \
./scenes/beet-debug.json \
./scenes/seek-3d.json \
Loading

0 comments on commit af7aafe

Please sign in to comment.