bevy_ecs_tilemap icon indicating copy to clipboard operation
bevy_ecs_tilemap copied to clipboard

Tiled map does not render anything

Open erayerdin opened this issue 1 year ago • 5 comments

I have a simple project set up.

The level is located under assets/level1.tmx.

level plugin has helper that I copied from the examples. It is almost identical to example. The only thing is I initialize Camera2dBundle in another plugin named RootPlugin.

However, this does not seem to render anything.

image

I move the camera but cannot see anything rendered.

These are the logs:

2023-10-26T11:03:33.185972Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-10-26T11:03:33.966073Z  INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event2 ( USB Gamepad          ) connected.    
2023-10-26T11:03:34.071429Z ERROR wgpu_hal::vulkan::instance: GENERAL [../src/amd/vulkan/radv_device.c:766 (0x0)]
        Device '/dev/dri/renderD128' is not using the AMDGPU kernel driver: Invalid argument (VK_ERROR_INCOMPATIBLE_DRIVER)    
2023-10-26T11:03:34.071495Z ERROR wgpu_hal::vulkan::instance:   objects: (type: INSTANCE, hndl: 0x55fd9f0389f0, name: ?)    
2023-10-26T11:03:34.092366Z  INFO bevy_render::renderer: AdapterInfo { name: "OLAND (, LLVM 15.0.7, DRM 2.50, 6.5.7-100.fc37.x86_64)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-10-26T11:03:34.277984Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2023-10-26T11:03:34.290913Z  WARN bevy_asset::asset_server: no `AssetLoader` found for the following extension: tmx
2023-10-26T11:03:34.304664Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected

This is just a small project to test out the waters, nothing too serious. I just want to study bevy.

Why might this be happening?

erayerdin avatar Oct 26 '23 11:10 erayerdin

The warning of note is

2023-10-26T11:03:34.290913Z  WARN bevy_asset::asset_server: no `AssetLoader` found for the following extension: tmx

It looks like you have not added your TiledMapPlugin to the App.

rparrett avatar Oct 26 '23 13:10 rparrett

Yep, you're on the right track, but now it seems I've got another one:

2023-10-26T13:18:08.598183Z  WARN bevy_asset::asset_server: encountered an error while loading an asset: Could not load TMX map: Missing attribute: tilecount

I think this is because I've used tilesets in a separate tsx files. Let me use a unified tmx file and get back to you.

erayerdin avatar Oct 26 '23 13:10 erayerdin

I've created q/0003 branch to review easily.

When the tileset is embedded to tmx file, I got a weird error saying:

2023-10-26T21:40:55.909127Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-10-26T21:40:56.581480Z  INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event2 ( USB Gamepad          ) connected.    
2023-10-26T21:40:56.718398Z ERROR wgpu_hal::vulkan::instance: GENERAL [../src/amd/vulkan/radv_device.c:766 (0x0)]
        Device '/dev/dri/renderD128' is not using the AMDGPU kernel driver: Invalid argument (VK_ERROR_INCOMPATIBLE_DRIVER)    
2023-10-26T21:40:56.718487Z ERROR wgpu_hal::vulkan::instance:   objects: (type: INSTANCE, hndl: 0x559325df69f0, name: ?)    
2023-10-26T21:40:56.741654Z  INFO bevy_render::renderer: AdapterInfo { name: "OLAND (, LLVM 15.0.7, DRM 2.50, 6.5.7-100.fc37.x86_64)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-10-26T21:40:56.942364Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2023-10-26T21:40:56.959171Z  INFO bvplatform::level::helpers::tiled: Loaded map: level1.tmx
2023-10-26T21:40:56.969941Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2023-10-26T21:40:57.207251Z  INFO bvplatform::level::helpers::tiled: Map added!
2023-10-26T21:40:57.595829Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
2023-10-26T21:40:57.595885Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
2023-10-26T21:40:57.595917Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
2023-10-26T21:40:57.595940Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
2023-10-26T21:40:57.595962Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
2023-10-26T21:40:57.595985Z ERROR wgpu_hal::gles::egl: GLES: [API/Error] ID 2 : GL_INVALID_VALUE in glCopyTexSubImage2D(xoffset 0 + width 32 > 1)    
thread 'Compute Task Pool (0)' panicked at 'index out of bounds: the len is 6 but the index is 6', /home/erayerdin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.16.2/src/gles/queue.rs:548:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_ecs_tilemap::render::material::queue_material_tilemap_meshes<bevy_ecs_tilemap::render::material::StandardTilemapMaterial>`!
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/erayerdin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.11.3/src/pipelined_rendering.rs:143:45

I get an index out of bounds error. I don't exactly know any idea why that happens since I don't have quite much of an idea of the internals of the project, but I think it has something to do with the structure of the layers. Although assets/level1.tmx is already there, there's the screenshot in case:

image

(1) The map has multiple layers to designate different parts of it and (2) tilesets are embedded.


While I was trying out things, I ran across another unintended behavior but I'm not sure if I need to open up another issue for that. Level is located under assets/level1.tmx, but if you save it under another directory such as assets/levels/level1.tmx, then final XML structure of tmx file refers to the assets relatively, which causes this strange error:

Also remember to change this line to use this path

2023-10-26T21:40:09.185813Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-10-26T21:40:09.928458Z  INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event2 ( USB Gamepad          ) connected.    
2023-10-26T21:40:10.067416Z ERROR wgpu_hal::vulkan::instance: GENERAL [../src/amd/vulkan/radv_device.c:766 (0x0)]
        Device '/dev/dri/renderD128' is not using the AMDGPU kernel driver: Invalid argument (VK_ERROR_INCOMPATIBLE_DRIVER)    
2023-10-26T21:40:10.067625Z ERROR wgpu_hal::vulkan::instance:   objects: (type: INSTANCE, hndl: 0x556ca8a0c9f0, name: ?)    
2023-10-26T21:40:10.087913Z  INFO bevy_render::renderer: AdapterInfo { name: "OLAND (, LLVM 15.0.7, DRM 2.50, 6.5.7-100.fc37.x86_64)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-10-26T21:40:10.282714Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2023-10-26T21:40:10.299789Z  INFO bvplatform::level::helpers::tiled: Loaded map: levels/level1.tmx
2023-10-26T21:40:10.300148Z  WARN bevy_asset::asset_server: encountered an error while reading an asset: path not found: /home/erayerdin/Projects/Trash/bvplatform/assets/levels/levels/../kings_and_pigs/Sprites/14-TileSets/Terrain (32x32).png
2023-10-26T21:40:10.300199Z  WARN bevy_asset::asset_server: encountered an error while reading an asset: path not found: /home/erayerdin/Projects/Trash/bvplatform/assets/levels/levels/../kings_and_pigs/Sprites/11-Door/Idle.png
2023-10-26T21:40:10.300250Z  WARN bevy_asset::asset_server: encountered an error while reading an asset: path not found: /home/erayerdin/Projects/Trash/bvplatform/assets/levels/levels/../kings_and_pigs/Sprites/14-TileSets/Decorations (32x32).png
2023-10-26T21:40:10.310500Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2023-10-26T21:40:10.528970Z  INFO bvplatform::level::helpers::tiled: Map added!
2023-10-26T21:40:22.757986Z  INFO bevy_window::system: No windows are open, exiting
2023-10-26T21:40:22.760189Z  INFO bevy_winit::system: Closing window 0v0

It seems asset server is trying to load relative path such as /home/erayerdin/Projects/Trash/bvplatform/assets/levels/levels/../kings_and_pigs/Sprites/14-TileSets/Decorations (32x32).png but fails to do so.

I've looked up any issues regarding to this but could not find any. If you allow, I can open up a different one to track this there since it's beyond the scope of #483 (this issue).

erayerdin avatar Oct 26 '23 22:10 erayerdin

index out of bounds

I think you are seeing https://github.com/StarArawn/bevy_ecs_tilemap/issues/395. It would be great to be able to narrow that to a minimal reproduction and get that fixed. It's possible that using the atlas feature would be a workaround.

relative paths

I was sure that we've dealt with relative paths in the Tiled example at some point, but I can't find an existing issue either. Feel free to open another issue.

rparrett avatar Oct 26 '23 22:10 rparrett

Please remember too that the tiled example is only meant as a minimal example. If anyone is interested in creating a bevy_tiled crate please let me know and I can help out with that.

StarArawn avatar Dec 20 '23 02:12 StarArawn