Giter Club home page Giter Club logo

bevy_entitiles's Introduction

Hi there πŸ‘‹

I'm 443eb9#C, a developer from China who is constantly striving for improvement.


What does my name actually mean?

  • 443eb9 is a random color I picked in Photoshop. I selected it from a plethora of colors, so I feel like we have a connection.
  • #C is the reverse representation of C#, which was my favorite language when I was a Unity developer. Also, "#" acts like a separator.

Currently, Rust πŸ¦€ is my favorite language. It runs fast, is memory-safe, and easy to write. Rust macros, enums, and iterators are the best things ever! C# is my second favorite language. It doesn't run as fast, but it's even easier to write.

I aspire to become a full-stack open-source game developer in the future. Besides coding, I'm also delving into painting and planning to learn cloth/building designing and music composition.

Anurag's GitHub stats

共勉

bevy_entitiles's People

Contributors

443eb9 avatar adrien-bon avatar doonv avatar martinlindhe avatar myomikron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bevy_entitiles's Issues

Compilation bug due to winit v0.28.7

Hello,
I'm trying to compile this library but I'm having a compilation error instead. I also have no issue compiling bevy examples on v0.12.1 (ex: cargo run --features x11 --example 2d_shapes works fine)

Log

Compilation log
➜  bevy_entitiles git:(master) βœ— cargo build
   Compiling hashbrown v0.14.3
   Compiling async-executor v1.8.0
   Compiling naga v0.13.0
   Compiling parking_lot v0.12.1
   Compiling blocking v1.5.1
   Compiling guillotiere v0.6.2
   Compiling winit v0.28.7
error: The platform you're compiling for is not supported by winit
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/mod.rs:67:1
   |
67 | compile_error!("The platform you're compiling for is not supported by winit");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `self::platform`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/mod.rs:26:15
   |
26 | pub use self::platform::*;
   |               ^^^^^^^^ could not find `platform` in `self`

error[E0432]: unresolved import `crate::platform_impl::PlatformIcon`
 --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/icon.rs:1:5
  |
1 | use crate::platform_impl::PlatformIcon;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `PlatformIcon` in `platform_impl`

error[E0433]: failed to resolve: could not find `DeviceId` in `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event.rs:789:33
    |
789 |         DeviceId(platform_impl::DeviceId::dummy())
    |                                 ^^^^^^^^ could not find `DeviceId` in `platform_impl`

error[E0433]: failed to resolve: could not find `WindowId` in `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:86:33
   |
86 |         WindowId(platform_impl::WindowId::dummy())
   |                                 ^^^^^^^^ could not find `WindowId` in `platform_impl`

error[E0433]: failed to resolve: could not find `Window` in `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:465:24
    |
465 |         platform_impl::Window::new(&window_target.p, self.window, self.platform_specific).map(
    |                        ^^^^^^ could not find `Window` in `platform_impl`

error[E0412]: cannot find type `OsError` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/error.rs:25:27
   |
25 |     error: platform_impl::OsError,
   |                           ^^^^^^^ not found in `platform_impl`
   |
help: there is an enum variant `crate::window::BadIcon::OsError`; try using the variant's enum
   |
25 |     error: crate::window::BadIcon,
   |            ~~~~~~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `OsError` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/error.rs:38:76
   |
38 |     pub(crate) fn new(line: u32, file: &'static str, error: platform_impl::OsError) -> OsError {
   |                                                                            ^^^^^^^ not found in `platform_impl`
   |
help: there is an enum variant `crate::window::BadIcon::OsError`; try using the variant's enum
   |
38 |     pub(crate) fn new(line: u32, file: &'static str, error: crate::window::BadIcon) -> OsError {
   |                                                             ~~~~~~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `DeviceId` in module `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event.rs:776:47
    |
776 | pub struct DeviceId(pub(crate) platform_impl::DeviceId);
    |                                               ^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `EventLoop` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:36:43
   |
36 |     pub(crate) event_loop: platform_impl::EventLoop<T>,
   |                                           ^^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `EventLoopWindowTarget` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:47:34
   |
47 |     pub(crate) p: platform_impl::EventLoopWindowTarget<T>,
   |                                  ^^^^^^^^^^^^^^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `PlatformSpecificEventLoopAttributes` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:57:50
   |
57 |     pub(crate) platform_specific: platform_impl::PlatformSpecificEventLoopAttributes,
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `platform_impl`

error[E0433]: failed to resolve: could not find `EventLoop` in `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:121:40
    |
121 |             event_loop: platform_impl::EventLoop::new(&mut self.platform_specific),
    |                                        ^^^^^^^^^ could not find `EventLoop` in `platform_impl`
    |
help: consider importing this struct
    |
10  + use crate::event_loop::EventLoop;
    |
help: if you import `EventLoop`, refer to it directly
    |
121 -             event_loop: platform_impl::EventLoop::new(&mut self.platform_specific),
121 +             event_loop: EventLoop::new(&mut self.platform_specific),
    |

error[E0412]: cannot find type `EventLoopProxy` in module `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:380:38
    |
380 |     event_loop_proxy: platform_impl::EventLoopProxy<T>,
    |                                      ^^^^^^^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `VideoMode` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/monitor.rs:18:43
   |
18 |     pub(crate) video_mode: platform_impl::VideoMode,
   |                                           ^^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `MonitorHandle` in module `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/monitor.rs:107:38
    |
107 |     pub(crate) inner: platform_impl::MonitorHandle,
    |                                      ^^^^^^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `VideoMode` in this scope
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/mod.rs:31:15
   |
31 |     Exclusive(VideoMode),
   |               ^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  + use crate::monitor::VideoMode;
   |

error[E0412]: cannot find type `MonitorHandle` in this scope
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/mod.rs:32:23
    |
32  |     Borderless(Option<MonitorHandle>),
    |                       ^^^^^^^^^^^^^
    |
   ::: /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/monitor.rs:106:1
    |
106 | pub struct MonitorHandle {
    | ------------------------ similarly named struct `RootMonitorHandle` defined here
    |
help: a struct with a similar name exists
    |
32  |     Borderless(Option<RootMonitorHandle>),
    |                       ~~~~~~~~~~~~~~~~~
help: consider importing this struct
    |
1   + use crate::monitor::MonitorHandle;
    |

error[E0412]: cannot find type `Window` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:45:39
   |
45 |     pub(crate) window: platform_impl::Window,
   |                                       ^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `WindowId` in module `platform_impl`
  --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:73:47
   |
73 | pub struct WindowId(pub(crate) platform_impl::WindowId);
   |                                               ^^^^^^^^ not found in `platform_impl`

error[E0412]: cannot find type `PlatformSpecificWindowBuilderAttributes` in module `platform_impl`
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:110:50
    |
110 |     pub(crate) platform_specific: platform_impl::PlatformSpecificWindowBuilderAttributes,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `platform_impl`

   Compiling bevy_tasks v0.12.1
   Compiling async-fs v1.6.0
error[E0282]: type annotations needed
   --> /home/romain/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/window.rs:492:17
    |
492 |         builder.build(event_loop)
    |                 ^^^^^ cannot infer type of the type parameter `T` declared on the method `build`
    |
help: consider specifying the generic argument
    |
492 |         builder.build::<T>(event_loop)
    |                      +++++

Some errors have detailed explanations: E0282, E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `winit` (lib) due to 22 previous errors
warning: build failed, waiting for other jobs to finish...

System information

  • cargo version: 1.75.0
  • SystemInfo { os: "Linux 24.05 NixOS", kernel: "6.6.10", cpu: "12th Gen Intel(R) Core(TM) i5-12400", core_count: "6", memory: "15.4 GiB" }
  • AdapterInfo { name: "AMD Radeon RX 6500 XT", vendor: 4098, device: 29759, device_type: DiscreteGpu, driver: "AMD open-source driver", driver_info: "2023.Q4.2 (LLPC)", backend: Vulkan }

Related issues

I'm looking at this issue rust-windowing/winit#3174 and trying to find a fix for our case.

Ldtk sprite flip is incorrect

I was working with IntGrid and Auto Layers and had some issues with the automatic sprite transformations.
It looks like the horizontal and vertical flip directions are swapped (a flip for both directions works just fine).

LDtk:
image

Bevy:
image

My guess is that the bitflags used in the uv flip in src/render/shaders/tilemap.wgsl are different to
what is assumed in src/ldtk/json/level.rs.

Swapping the bitflags in the shader seemed to fix the problem.

Errors in tiled example

Description

Logs:

2024-04-12T20:42:11.878635Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-04-12T20:42:11.879108Z  INFO log: Guessed window scale factor: 2    
2024-04-12T20:42:11.987808Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6500 XT (RADV NAVI24)", vendor: 4098, device: 29759, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.3.6", backend: Vulkan }
2024-04-12T20:42:12.016972Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::AmbientLight, but it wasn't registered in the type registry.
2024-04-12T20:42:12.016989Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::PointLight, but it wasn't registered in the type registry.
2024-04-12T20:42:12.016993Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::DirectionalLight, but it wasn't registered in the type registry.
2024-04-12T20:42:12.016997Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::pbr_material::StandardMaterial, but it wasn't registered in the type registry.
2024-04-12T20:42:12.017005Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::ClusterConfig, but it wasn't registered in the type registry.
2024-04-12T20:42:12.042817Z  INFO system{name="bevy_diagnostic::system_information_diagnostics_plugin::internal::log_system_info"}: bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 39 Fedora Linux", kernel: "6.8.4-200.fc39.x86_64", cpu: "Intel(R) Xeon(R) W-2195 CPU @ 2.30GHz", core_count: "18", memory: "251.4 GiB" }
2024-04-12T20:42:15.371670Z  WARN system{name="bevy_entitiles::tiled::load_tiled_xml"}: bevy_entitiles::tiled::resources: Object rotation is not recommended! It will results in wrong collision shapes. But if you just want to use this object as sort of static image it will be ok.
2024-04-12T20:42:15.390546Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get material bind group!
2024-04-12T20:42:16.935978Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get material bind group!
2024-04-12T20:42:16.955157Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get tilemap instance!
2024-04-12T20:42:19.867773Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get material bind group!
2024-04-12T20:42:19.888908Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get tilemap instance!
2024-04-12T20:42:23.300433Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get material bind group!
2024-04-12T20:42:23.317788Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get tilemap instance!
2024-04-12T20:42:23.734168Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get material bind group!
2024-04-12T20:42:23.751098Z ERROR system{name="bevy_render::renderer::render_system"}:run_graph{name="main_graph"}:run_graph{name="Core2d"}:node{name="bevy_core_pipeline::core_2d::main_pass_2d_node::MainPass2dNode"}:main_pass_2d: bevy_entitiles::render::draw: Failed to get tilemap instance!
2024-04-12T20:42:27.512215Z  INFO system{name="bevy_window::system::exit_on_all_closed"}: bevy_window::system: No windows are open, exiting
2024-04-12T20:42:27.519069Z  INFO system{name="bevy_winit::system::despawn_windows"}: bevy_winit::system: Closing window 0v1

Reproduction

git checkout 0.7.0
cargo run --example tiled --features=tiled,physics

Versions

  • OS: Linux
  • Crate and other dependencies: 0.7.0

Error compiling for webassembly

Description

Error compiling for webassembly

Reproduction

  1. comment out trace_tracy dependency in Cargo.toml as ittracy-client-sys v0.22.2 wont compile for wasm

  2. cargo build --target wasm32-unknown-unknown --example pathfinding --features algorithm

Versions

  • OS: Linux
  • Crate and other dependencies: git master

Additional

Compile error:

❯ cargo build --target wasm32-unknown-unknown --example pathfinding --features algorithm
   Compiling bevy_entitiles v0.6.1 (/home/m/dev/rs/bevy_entitiles)
error[E0271]: type mismatch resolving `<Vec<(Entity, FakeTask)> as IntoIterator>::Item == (Entity, Task<Path>)`
   --> src/algorithm/pathfinding.rs:285:32
    |
285 |             queue.tasks.extend(tasks);
    |                         ------ ^^^^^ expected `(Entity, Task<Path>)`, found `(Entity, FakeTask)`
    |                         |
    |                         required by a bound introduced by this call
    |
    = note: expected tuple `(bevy::prelude::Entity, Task<pathfinding::Path>)`
               found tuple `(bevy::prelude::Entity, FakeTask)`
note: required by a bound in `extend`
   --> /home/m/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:372:31
    |
372 |     fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T);
    |                               ^^^^^^^^ required by this bound in `Extend::extend`

error[E0308]: mismatched types
   --> src/algorithm/wfc.rs:654:29
    |
654 |             .insert(WfcTask(task))
    |                     ------- ^^^^ expected `Task<Option<WfcData>>`, found `FakeTask`
    |                     |
    |                     arguments to this struct are incorrect
    |
    = note: expected struct `Task<std::option::Option<WfcData>>`
               found struct `FakeTask`
note: tuple struct defined here
   --> src/algorithm/wfc.rs:636:12
    |
636 | pub struct WfcTask(Task<Option<WfcData>>);
    |            ^^^^^^^

Some errors have detailed explanations: E0271, E0308.
For more information about an error, try `rustc --explain E0271`.
error: could not compile `bevy_entitiles` (lib) due to 2 previous errors

Derive `Reflect`, `MapEntities`

In order to support bevy_scene or any other reflection-enabled save/load system for Bevy, you will need to derive Reflect on every Resource and Component that should be saved to disk.

This also allows real-time inspection with a tool like bevy-inspector-egui.

Any Components or Resources containing Entities should also implement MapEntities in order to properly handle unstable entity IDs.

I can put together a PR if you tell me which types should be included.

Bug: Tiles rendering in the wrong order

When loading tile maps from Tiled the rendering order is not correct. (Moist likely needs to take into account the modifications done here).

Reproduction

Build a isometric tile map in Tiled with cubic assets and try to load them.

Screenshots
image

Versions

  • OS: Windows 11
  • Crate and other dependencies: entitiles master branch, with tiled and atlas features enabled.

Additional
In order to create the desired effect there needs to be at least two tile layers.

Doc: Examples with pitfalls

I decided to fully understand how to work with this crate.

As a result, I found a bunch of incomprehensible things that made me doubt the correctness of my own project.

Here in the examples it seems to sign how and what works, but when trying to write it myself, I encountered multiple import errors, etc. As a result, if you go deeper, it turns out that there are many imports already inside libraries that are implemented by features, etc.; Which slows down the investigation. As a result, it is simply unclear how and what and where to use, everything is cursed and everything is needed, but if you integrate it completely into your system, then your own project may fall.

(Because of the features in bevy_entities, more precisely with serialization, which as a result goes into prescribing [features] at home, breaks the project, because in order to use [features] without errors, you need to have the optional parameter in the dependencies, and it does not allow you to use this dependency in the rest of the code, which happened at me with serde)

Toggle tilemap visibility

Current Problem

Full disclosure: I might be confused and missing something :-)

I have been porting over my code from using bevy_ecs_tilemap where I could toggle visibility of tilemap layers, but having issues replicating this with bevy_entitiles.

I would like to toggle visibility of a tilemap layer, but it seems the StandardTilemapBundle does not have Visibility.

Here's some snippets from my current project:

#[derive(Component)]
struct TilemapLayer1;

...
let entity1 = commands.spawn_empty().id();
let mut tilemap1 = StandardTilemapBundle {
    tile_render_size: TileRenderSize(Vec2::new(TILE_WIDTH as f32, TILE_HEIGHT as f32)),
    slot_size: TilemapSlotSize(Vec2::new(TILE_WIDTH as f32, TILE_HEIGHT as f32)),
    ty: TilemapType::Square,
    storage: TilemapStorage::new(32, entity1),
    texture: TilemapTexture::new(
        textures.tiles_ground.clone(),
        TilemapTextureDescriptor::new(UVec2 { x: 480, y: 896 }, UVec2 { x: 32, y: 32 }, FilterMode::Nearest),
        TilemapRotation::None,
    ),
    ..Default::default()
};
commands.entity(entity1).insert((tilemap1, TilemapLayer1));
...

fn toggle_tilemap_overlay1(
    keyboard: Res<ButtonInput<KeyCode>>,
    mut query: Query<&mut Visibility, With<TilemapLayer1>>,
) {
    if keyboard.just_pressed(KeyCode::KeyO) {
        let mut vis_layer = query.single_mut();
        *vis_layer = if *vis_layer == Visibility::Hidden {
            Visibility::Visible
        } else {
            Visibility::Hidden
        };
    }
}

When I execute toggle_tilemap_overlay1, I crash with the following error:

NoEntities("bevy_ecs::query::state::QueryState<&mut bevy_render::view::visibility::Visibility, bevy_ecs::query::filter::With<game::game::world::ground::TilemapLayer1>>")

ldtk example crashes

Description

It seems the string "ignore " is prepended to the asset name, causing it to fail to load.

Logs:

2024-04-12T20:44:49.206877Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-04-12T20:44:49.207397Z  INFO log: Guessed window scale factor: 2    
2024-04-12T20:44:49.332413Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6500 XT (RADV NAVI24)", vendor: 4098, device: 29759, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.3.6", backend: Vulkan }
2024-04-12T20:44:49.363404Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::AmbientLight, but it wasn't registered in the type registry.
2024-04-12T20:44:49.363425Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::PointLight, but it wasn't registered in the type registry.
2024-04-12T20:44:49.363429Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::DirectionalLight, but it wasn't registered in the type registry.
2024-04-12T20:44:49.363434Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::pbr_material::StandardMaterial, but it wasn't registered in the type registry.
2024-04-12T20:44:49.363442Z  WARN bevy_inspector_egui::inspector_options::default_options: Attempting to set default inspector options for bevy_pbr::light::ClusterConfig, but it wasn't registered in the type registry.
   0: bevy_ecs::system::function_system::system
           with name="bevy_entitiles::ldtk::parse_ldtk_json"
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/function_system.rs:47
thread 'main' panicked at src/ldtk/resources.rs:379:23:
Could not read file at path: "/Depot/Projects/Gaming/bevy_entitiles/assets/ldtk/ignore grid_vania.ldtk"!
No such file or directory (os error 2)
stack backtrace:
   0: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   2: bevy_entitiles::ldtk::resources::LdtkLevelManager::reload_json
             at ./src/ldtk/resources.rs:379:23
   3: bevy_entitiles::ldtk::parse_ldtk_json
             at ./src/ldtk/mod.rs:152:5
   4: core::ops::function::FnMut::call_mut
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:166:5
   5: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:294:13
   6: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1) .> Out>>::run::call_inner
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/function_system.rs:656:21
   7: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1) .> Out>>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/function_system.rs:659:17
   8: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/function_system.rs:499:19
   9: bevy_ecs::system::system::System::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system.rs:76:18
  10: <bevy_ecs::schedule::executor::single_threaded::SingleThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/single_threaded.rs:101:21
  11: core::ops::function::FnOnce::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  12: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  13: std::panicking::try::do_call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  14: std::panicking::try
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  15: std::panic::catch_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  16: <bevy_ecs::schedule::executor::single_threaded::SingleThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/single_threaded.rs:100:27
  17: bevy_ecs::schedule::schedule::Schedule::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/schedule.rs:345:13
  18: bevy_ecs::world::World::try_run_schedule::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2292:55
  19: bevy_ecs::world::World::try_schedule_scope
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2225:21
  20: bevy_ecs::world::World::try_run_schedule
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2292:9
  21: bevy_app::main_schedule::Main::run_main::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_app-0.13.2/src/main_schedule.rs:225:35
  22: bevy_ecs::world::World::resource_scope
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:1672:22
  23: bevy_app::main_schedule::Main::run_main
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_app-0.13.2/src/main_schedule.rs:223:13
  24: core::ops::function::FnMut::call_mut
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:166:5
  25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:294:13
  26: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run::call_inner
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/exclusive_function_system.rs:206:21
  27: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/exclusive_function_system.rs:209:17
  28: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/exclusive_function_system.rs:111:23
  29: bevy_ecs::world::World::last_change_tick_scope
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:1981:9
  30: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/exclusive_function_system.rs:103:9
  31: <bevy_ecs::schedule::executor::single_threaded::SingleThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/single_threaded.rs:101:21
  32: core::ops::function::FnOnce::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  33: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  34: std::panicking::try::do_call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  35: std::panicking::try
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  36: std::panic::catch_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  37: <bevy_ecs::schedule::executor::single_threaded::SingleThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/executor/single_threaded.rs:100:27
  38: bevy_ecs::schedule::schedule::Schedule::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/schedule/schedule.rs:345:13
  39: bevy_ecs::world::World::run_schedule::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2306:51
  40: bevy_ecs::world::World::try_schedule_scope
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2225:21
  41: bevy_ecs::world::World::schedule_scope
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2277:9
  42: bevy_ecs::world::World::run_schedule
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/world/mod.rs:2306:9
  43: bevy_app::app::App::update
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_app-0.13.2/src/app.rs:263:24
  44: bevy_winit::run_app_update_if_should
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_winit-0.13.2/src/lib.rs:741:9
  45: bevy_winit::handle_winit_event
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_winit-0.13.2/src/lib.rs:618:21
  46: bevy_winit::winit_runner::{{closure}}
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_winit-0.13.2/src/lib.rs:290:9
  47: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:294:13
  48: winit::platform_impl::platform::x11::EventLoop<T>::single_iteration
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:602:17
  49: winit::platform_impl::platform::x11::EventLoop<T>::pump_events
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:441:13
  50: winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:408:19
  51: winit::platform_impl::platform::EventLoop<T>::run_on_demand
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:829:56
  52: winit::platform_impl::platform::EventLoop<T>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:822:9
  53: winit::event_loop::EventLoop<T>::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:249:9
  54: bevy_winit::winit_runner
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_winit-0.13.2/src/lib.rs:305:34
  55: core::ops::function::FnOnce::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  56: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  57: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2015:9
  58: bevy_app::app::App::run
             at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_app-0.13.2/src/app.rs:308:9
  59: ldtk::main
             at ./examples/ldtk.rs:52:5
  60: core::ops::function::FnOnce::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_entitiles::ldtk::parse_ldtk_json`!
2024-04-12T20:44:49.865748Z  WARN bevy_app:winit event_handler:update:main app:schedule{name=Main}: bevy_ecs::system::commands::command_queue: CommandQueue has un-applied commands being dropped.
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Reproduction

git checkout 0.7.0
RUST_BACKTRACE=1 cargo run --example ldtk --features=debug,ldtk,physics

Versions

  • OS: Linux
  • Crate and other dependencies: entitiles: 0.7.0

Add ldtk map assets

Hello,

Thanks for the plugin, its looking really good. But on trying to run examples, I realized ldtk assets are missing, so there is no easy way to see the example, and test it out.

Could you add simple map assets?

Thx

Mike

Doc: 'Warning' is misspelt as Warining

Location
README.md

Actual Behavior
The header 'warining' seems to be a spelling mistake. The correct word would be warning. If this is intentional, please feel free to dismiss this issue. If it isn't, I'll happily create a pull request to fix this.

(I know how silly it is to file an issue over so minor a mistake, I hope I'm not wasting your time)

Documentation on using LDTK for 2d, top-down

I greatly appreciate this plugin! Especially the dedication to keeping it up to date. That stated, I'm struggling with some holes in the documentation--once I've learned some more, happy to send a PR to help improve the docs.

Here's my current problem. I'm trying to us the LDTK feature to load a map. Everything is going well, but it seems the walls in the IntGrid are not having the component I've attached. Ultimately, I need a Wall component to be attached to buildings and structure for blocking.

Problem stated, here's what I've seen. In the ldtk example it seems entities have structs attached when the map is loaded, however, I can't seem the right combination to get these components attached to tiles.

App::new()
       ...
        .register_type::<Player>()
        .register_type::<Wall>() 
        .register_ldtk_entity::<Wall>("walls")
        .init_resource::<CameraControl>(
        .insert_resource(Msaa::Off)
        .insert_resource(LdtkLoadConfig {
            file_path: "assets/testy2.ldtk".to_string(),
            filter_mode: FilterMode::Nearest,
            ..Default::default()
        })
        .run();
...
#[derive(Component, LdtkEntity, Default, Reflect)]
pub struct Wall;

In the example I see the

        .insert_resource(LdtkAdditionalLayers {
            physics_layer: Some(LdtkPhysicsLayer {
                identifier: "PhysicsColliders".to_string(),
                air: 0,
                parent: "Collisions".to_string(),
                tiles: Some(HashMap::from([
                    (
                        1,
                        PhysicsTile {
                            rigid_body: true,
                            friction: Some(0.9),
                        },
                    ),
                    (
                        2,
                        PhysicsTile {
                            rigid_body: true,
                            friction: Some(0.1),
                        },
                    ),
                ])),
            }),
            ..Default::default()
        })

Is this just for just adding a physics engine? Or should it also be used for creating blocking tiles? I saw this bit in the docs,

ldtk Introduces the way to load/unload/switching between LDtk levels, and some extra functionalities including automatically generate the PathTilemap and PhysicsTilemap according to the specific int grid layers, map the tile_id to animations.

So I wouldn't think I'd need to create a hash map of the values, unless I wanted more granular controls of their physics.

Anyway, any nudges towards the correct direction would be greatly appreciated, as I'm very much enjoying the plugin! And if I'm asking the wrong question, forgive me. I'm moonlighting game dev.

image image

Wrong colliders size from LDTk level

Hello,
I'm experiencing a bug with the automatic colliders creation, see images.

This how I use LdtkPhysicsLayer:

        .insert_resource(LdtkAdditionalLayers {
            physics_layer: Some(LdtkPhysicsLayer {
                identifier: "PhysicsColliders".to_string(),
                air: 0,
                parent: "Collisions".to_string(),
                tiles: Some(HashMap::from([(
                    1,
                    PhysicsTile {
                        rigid_body: true,
                        friction: Some(0.9),
                    },
                )])),
            }),
            ..Default::default()
        })

The bottom wall and the left wall have wrong collider size:
in_game
in_ldtk

Dependencies

[dependencies]
bevy = "0.12"
bevy_entitiles = {version = "0.4.0", features = ["ldtk", "physics"]}
bevy_xpbd_2d = "0.3.3"
bevy_entitiles_derive = "0.3.0"
bevy-inspector-egui = "0.22.1"

System information

  • cargo version: 1.75.0
  • SystemInfo { os: "Linux 24.05 NixOS", kernel: "6.6.10", cpu: "12th Gen Intel(R) Core(TM) i5-12400", core_count: "6", memory: "15.4 GiB" }
  • AdapterInfo { name: "AMD Radeon RX 6500 XT", vendor: 4098, device: 29759, device_type: DiscreteGpu, driver: "AMD open-source driver", driver_info: "2023.Q4.2 (LLPC)", backend: Vulkan }

Other: Examples aren't really working "out of the box", maybe they could use more docs

Description

I tried cloning the repository then running some of the provided examples, however they either don't run, don't render anything or render things I'm not sure are right.

Reproduction

Clone the repo in a new directory, then run:

ldtk_wfc

run with cargo run -r --example ldtk_wfc --features="algorithm ldtk physics"

Compiles out of the box and doesn't show any warning on the console (except one for an AmbientLight that wasnt' registered in the type registry) but then the output is the following:

image

ldtk

This example isn't straightforward to run even after inspecting the code.
run with: cargo run -r --example ldtk --features="debug ldtk physics"

When running it right after cloning, it panics because it searches for an assets/ldtk/ignore grid_vania.ldtk
If I rename the existing assets/ldtk/grid_vania.ldtk to assets/ldtk/ignore grid_vania.ldtk, the app runs but I get this:

image

I also noticed that the example's code mention not having finalbossblues-icons_full_16.png available, but it's still there in the repo inside assets/ldtk

❯ git log assets/ldtk/finalbossblues-icons_full_16.png
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
commit 83c6144e79023e7dbb0e40d51ec3392e39e307fa ┃
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Author: 443eb9#C <[email protected]>
Date:   Tue Dec 19 18:38:31 2023 +0800

    Uploaded ldtk asstes.

To make sure the problem wasn't the asset, I saved LDTk 1.5.3's Gridvania sample in the assets/ldtk directory as "ignore etc.", but if I run the example again, I get the same result as above.

wfc

run with: cargo run -r --example wfc --features="algorithm"

Here the application;s output might be correct, but it's not clear.

image

wfc_pattern

run with: cargo run -r --example wfc_pattern --features="algorithm"

Here apparently nothing happens... but if you read the example's source there's a comment about removing some lines, running the example, then restoring them... and after I did that I actually got an output very much like the wfc example above (but with a smaller map, so they're probably both correct)

Suggestion

Maybe we should have a README.md for the examples (or separate the examples in directories and have a README.md in each of them) where to list any requirement to run an example, the compilation command and the expected output, like I've seen done in other projects.

Versions

  • OS: SystemInfo { os: "Windows 11 Pro", kernel: "22621", cpu: "Intel(R) Core(TM) i7-10870H CPU @ 2.20GHz", core_count: "8", memory: "15.8 GiB" }
  • Graphics: AdapterInfo { name: "NVIDIA GeForce RTX 3070 Laptop GPU", vendor: 4318, device: 9373, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "546.33", backend: Vulkan }
  • Entitiles version: git clone of latest master fea6608

Consider a prelude?

This is a great project - I apologize if this is not a wanted issue type, please delete if so. I noticed that many of the examples use a lot of imports to the point of being >10 lines. Would you consider creating a prelude such as bevy's prelude to export all useful types?

FeatureRequest: Add support for multiple tilesets for tilemaps imported from Tiled.

Description

I cannot get bevy_entitles to load my tmx. Note that this is a very simple tmx with no custom objects.

The log isn't helping me much, but maybe you can help me understand where the problem is?

2024-04-12T20:54:27.963207Z  WARN bevy_entitiles::tiled::resources: Object rotation is not recommended! It will results in wrong collision shapes. But if you just want to use this object as sort of static image it will be ok.
thread 'main' panicked at /home/emblemparade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_entitiles-0.7.0/src/tiled/xml/layer.rs:308:35:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:144:5
   3: bevy_entitiles::tiled::xml::layer::Tiles::iter_decoded::{{closure}}
   4: bevy_entitiles::tiled::load_layer
   5: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   6: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
   7: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll
   8: std::panicking::try
   9: async_task::raw::RawTask<F,T,S,M>::run
  10: bevy_tasks::thread_executor::ThreadExecutorTicker::tick::{{closure}}
  11: futures_lite::future::block_on
  12: bevy_tasks::task_pool::TaskPool::scope_with_executor
  13: <bevy_ecs::schedule::executor::multi_threaded::MultiThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
  14: bevy_ecs::schedule::schedule::Schedule::run
  15: bevy_ecs::world::World::try_schedule_scope
  16: bevy_ecs::world::World::resource_scope
  17: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run
  18: <bevy_ecs::schedule::executor::single_threaded::SingleThreadedExecutor as bevy_ecs::schedule::executor::SystemExecutor>::run
  19: bevy_ecs::schedule::schedule::Schedule::run
  20: bevy_ecs::world::World::schedule_scope
  21: bevy_app::app::App::update
  22: bevy_winit::run_app_update_if_should
  23: bevy_winit::winit_runner::{{closure}}
  24: winit::platform_impl::platform::EventLoop<T>::run
  25: bevy_winit::winit_runner
  26: core::ops::function::FnOnce::call_once{{vtable.shim}}
  27: bevy_app::app::App::run
  28: great_game::main
  29: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_entitiles::tiled::load_tiled_xml`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Versions

  • OS: Linux
  • Crate and other dependencies: entitiles: 0.4.0

Panic on too large dimensions on tileset

Hi there,
I'd try to use your crate as replacement for bevy_ecs_tilemap. I've also encountered the same error there, but when activating the atlas feature, the problem was gone.

2024-01-14T20:37:52.440892Z ERROR log: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (3)' panicked at /home/omikron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:3056:5:
wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `tilemap_texture_array`
    Dimension Z value 2816 exceeds the limit of 2048

Encountered a panic in system `bevy_entitiles::render::prepare::prepare_tilemaps`!
thread 'main' panicked at /home/omikron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.1/src/pipelined_rendering.rs:145:45:
called `Result::unwrap()` on an `Err` value: RecvError

Bug: texture tiles not rendered if setup by state machine

Description

I've tried to run example 'basic.rs', but setup is called via .add_systems(OnEnter(AppState::Other), setup). Colour tilemap is displayed correctly, but square and isometric textures are not rendered at all. If running as .add_systems(Startup, setup) everything works correctly.

Reproduction
Run code (function setup() is copied directly from the example)

use bevy::diagnostic::LogDiagnosticsPlugin;
use bevy::log::LogPlugin;
use bevy::prelude::*;
use bevy::render::render_resource::FilterMode;
use bevy::window::PresentMode;
use bevy_entitiles::prelude::{
    PureColorTilemapBundle, TileArea, TileBuilder, TileLayer, TileRenderSize, TileUpdater,
    TilemapBundle, TilemapName, TilemapSlotSize, TilemapStorage, TilemapTexture,
    TilemapTextureDescriptor, TilemapTransform, TilemapType,
};
use bevy_entitiles::tilemap::map::TilemapRotation;
use bevy_entitiles::tilemap::tile::{LayerUpdater, TileFlip, TileLayerPosition};
use bevy_entitiles::EntiTilesPlugin;

#[derive(States, PartialEq, Eq, Debug, Clone, Hash, Default, Copy)]
pub enum AppState {
    #[default]
    Init,
    Other,
}

fn main() {
    App::new()
        .add_plugins(
            DefaultPlugins
                .set(WindowPlugin {
                    primary_window: Some(Window {
                        title: String::from("Tilemap example"),
                        resolution: (1820., 920.).into(),
                        // disable vsync so we can see the raw FPS speed
                        present_mode: PresentMode::Immediate,
                        ..default()
                    }),
                    ..default()
                })
                .set(LogPlugin {
                    filter: "info,rpg=debug".to_string(),
                    level: bevy::log::Level::DEBUG,
                }),
        )
        .add_state::<AppState>()
        .add_plugins(LogDiagnosticsPlugin::default())
        .add_plugins(EntiTilesPlugin)
        .add_systems(OnEnter(AppState::Other), setup)
        .add_systems(Update, change_state.run_if(in_state(AppState::Init)))
        .run();
}

fn change_state(mut app_state: ResMut<NextState<AppState>>) {
    app_state.set(AppState::Other);
}

fn setup(mut commands: Commands, assets_server: Res<AssetServer>) {
    commands.spawn(Camera2dBundle::default());

    let entity = commands.spawn_empty().id();
    // You can go to each component's definition to see what they do.
    let mut tilemap = TilemapBundle {
        name: TilemapName("test_map".to_string()),
        tile_render_size: TileRenderSize(Vec2 { x: 16., y: 16. }),
        slot_size: TilemapSlotSize(Vec2 { x: 16., y: 16. }),
        ty: TilemapType::Square,
        storage: TilemapStorage::new(16, entity),
        texture: TilemapTexture::new(
            assets_server.load("test_square.png"),
            TilemapTextureDescriptor::new(
                UVec2 { x: 32, y: 32 },
                UVec2 { x: 16, y: 16 },
                FilterMode::Nearest,
            ),
            TilemapRotation::None,
        ),
        ..Default::default()
    };

    tilemap.storage.fill_rect(
        &mut commands,
        TileArea::new(IVec2::ZERO, UVec2 { x: 20, y: 10 }),
        TileBuilder::new().with_layer(0, TileLayer::new().with_texture_index(0)),
    );

    tilemap.storage.fill_rect(
        &mut commands,
        TileArea::new(IVec2 { x: 2, y: 2 }, UVec2 { x: 10, y: 7 }),
        TileBuilder::new()
            .with_layer(0, TileLayer::new().with_texture_index(1))
            .with_color(Vec4::new(0.8, 1., 0.8, 0.5)),
    );

    tilemap.storage.set(
        &mut commands,
        IVec2 { x: 18, y: 8 },
        TileBuilder::new()
            .with_layer(0, TileLayer::new().with_texture_index(0))
            .with_color(Color::BLUE.into()),
    );

    tilemap.storage.set(
        &mut commands,
        IVec2 { x: 1, y: 1 },
        TileBuilder::new().with_layer(
            1,
            TileLayer::new()
                .with_texture_index(1)
                .with_flip(TileFlip::Horizontal),
        ),
    );

    tilemap.storage.set(
        &mut commands,
        IVec2 { x: 1, y: 2 },
        TileBuilder::new().with_layer(
            0,
            TileLayer::new()
                .with_texture_index(1)
                .with_flip(TileFlip::Vertical),
        ),
    );

    tilemap.storage.set(
        &mut commands,
        IVec2 { x: 1, y: 3 },
        TileBuilder::new().with_layer(
            0,
            TileLayer::new()
                .with_texture_index(1)
                .with_flip(TileFlip::Both),
        ),
    );

    tilemap.storage.update_rect(
        &mut commands,
        TileArea::new(IVec2 { x: 1, y: 3 }, UVec2 { x: 3, y: 3 }),
        TileUpdater {
            layer: Some(LayerUpdater {
                position: TileLayerPosition::Top,
                layer: TileLayer::new().with_texture_index(3),
            }),
            ..Default::default()
        },
    );

    commands.entity(entity).insert(tilemap);

    let entity = commands.spawn_empty().id();
    let mut tilemap = TilemapBundle {
        name: TilemapName("test_map".to_string()),
        tile_render_size: TileRenderSize(Vec2 { x: 32., y: 16. }),
        slot_size: TilemapSlotSize(Vec2 { x: 32., y: 16. }),
        ty: TilemapType::Isometric,
        storage: TilemapStorage::new(32, entity),
        texture: TilemapTexture::new(
            assets_server.load("test_isometric.png"),
            TilemapTextureDescriptor::new(
                UVec2 { x: 32, y: 32 },
                UVec2 { x: 32, y: 16 },
                FilterMode::Nearest,
            ),
            TilemapRotation::None,
        ),
        transform: TilemapTransform {
            translation: Vec2 { x: -400., y: 0. },
            ..Default::default()
        },
        ..Default::default()
    };

    tilemap.storage.fill_rect(
        &mut commands,
        TileArea::new(IVec2::ZERO, UVec2 { x: 20, y: 10 }),
        TileBuilder::new().with_layer(0, TileLayer::new().with_texture_index(0)),
    );

    commands.entity(entity).insert(tilemap);

    let entity = commands.spawn_empty().id();
    let mut tilemap = PureColorTilemapBundle {
        name: TilemapName("test_map".to_string()),
        tile_render_size: TileRenderSize(Vec2 { x: 16., y: 16. }),
        slot_size: TilemapSlotSize(Vec2 { x: 16., y: 16. }),
        ty: TilemapType::Square,
        storage: TilemapStorage::new(32, entity),
        transform: TilemapTransform {
            translation: Vec2 { x: 0., y: -300. },
            ..Default::default()
        },
        ..Default::default()
    };

    tilemap.storage.fill_rect(
        &mut commands,
        TileArea::new(IVec2::ZERO, UVec2 { x: 20, y: 10 }),
        TileBuilder::new()
            .with_layer(0, TileLayer::new().with_texture_index(0))
            .with_color(Vec4::new(1., 1., 0., 1.)),
    );

    commands.entity(entity).insert(tilemap);
}

Screenshots
obraz

Versions

  • OS: Linux
  • Crate and other dependencies:
    • bevy = "0.12"
    • bevy_entitiles = "0.5.0"

Additional

Relax dependencies

Hi there,

I think it would be nice, if you could relax the versions of the dependencies of your crate.
Most of rusts ecosystem is using semver and follow its versioning quite strictly.

I'd exclude bevy related crates as some of them follow bevys schema to make it easier selecting the correct version.

No graphics rendered

Tried both the dev branch and the latest versions of crates.io.

result:
image

code:

let (tilemap_entity, mut tilemap) = TilemapBuilder::new(
        TileType::Square,
        UVec2 { x: 100, y: 100 },
        Vec2 { x: 512.0, y: 512.0 },
    )
    .with_translation(Vec2::new(0.0, 0.0))
    .with_uniform_texture(
        texture_handle,
        UVec2::new(3, 1),
        FilterMode::Nearest,
    )
    .build(&mut commands);

tilemap.fill_rect(
    &mut commands,
    FillArea::full(&tilemap),
     &TileBuilder::new(UVec2::ZERO, 0),
);

commands.entity(tilemap_entity).insert(tilemap);

texture(512x512):

terrains

ε¦‚ζžœε―δ»₯ηš„θ―ε―δ»₯η›΄ζŽ₯δΈ­ζ–‡δΊ€ζ΅οΌŒθ‹±θ―­ζΈ£οΌˆ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.