bevy_ecs_tilemap
bevy_ecs_tilemap copied to clipboard
Update to Bevy 0.12.0
Bevy 0.12.0 has released, please update to it.
I have a branch in a "compiling but seemingly not even close to working" state here: https://github.com/rparrett/bevy_ecs_tilemap/tree/bevy-0.12. Unfortunately, the migration seems pretty involved and Bevy's migration guide leaves a lot to be desired. There were massive changes to rendering and I don't have time to become a rendering expert. I know the author is also very time-constrained. But I may have a few hours tonight or tomorrow to investigate.
Last update 👋 @mwbryant did most of the work. Any chance you're still working with bevy_ecs_tilemap
?
I'll take a look at the branch and see if I can fix it.
I'm trying to port it to 0.12 myself, but it looks like someone forgot to implement Clone
for VisibilityBundle
. lol
guess i have to make a bevy PR. but just not implementing Clone
works for now
since people are piling on various issues.. i'll also add that compiling for web target/wasm is failing a bunch of different ways now. For some reason isn't getting picked up by Rust Analyzer.
871 | type ComputePipelineData = Sendable<web_sys::GpuComputePipeline>;
| ^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:872:49
|
872 | type CommandEncoderId = Identified<web_sys::GpuCommandEncoder>;
| ^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:873:49
|
873 | type CommandEncoderData = Sendable<web_sys::GpuCommandEncoder>;
| ^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuComputePassEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:874:46
|
874 | type ComputePassId = Identified<web_sys::GpuComputePassEncoder>;
| ^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuComputePassEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:875:46
|
875 | type ComputePassData = Sendable<web_sys::GpuComputePassEncoder>;
| ^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderPassEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:876:45
|
876 | type RenderPassId = Identified<web_sys::GpuRenderPassEncoder>;
| ^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderPassEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:877:45
|
877 | type RenderPassData = Sendable<web_sys::GpuRenderPassEncoder>;
| ^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCommandBuffer` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:878:48
|
878 | type CommandBufferId = Identified<web_sys::GpuCommandBuffer>;
| ^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCommandBuffer` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:879:48
|
879 | type CommandBufferData = Sendable<web_sys::GpuCommandBuffer>;
| ^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderBundleEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:880:54
|
880 | type RenderBundleEncoderId = Identified<web_sys::GpuRenderBundleEncoder>;
| ^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderBundleEncoder` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:881:54
|
881 | type RenderBundleEncoderData = Sendable<web_sys::GpuRenderBundleEncoder>;
| ^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderBundle` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:882:47
|
882 | type RenderBundleId = Identified<web_sys::GpuRenderBundle>;
| ^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuRenderBundle` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:883:47
|
883 | type RenderBundleData = Sendable<web_sys::GpuRenderBundle>;
| ^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCanvasContext` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:884:51
|
884 | type SurfaceId = Identified<(Canvas, web_sys::GpuCanvasContext)>;
| ^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuCanvasContext` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:885:51
|
885 | type SurfaceData = Sendable<(Canvas, web_sys::GpuCanvasContext)>;
| ^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0412]: cannot find type `GpuUncapturedErrorEvent` in crate `web_sys`
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:1791:62
|
1791 | let f = Closure::wrap(Box::new(move |event: web_sys::GpuUncapturedErrorEvent| {
| ^^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`
error[E0599]: no method named `gpu` found for struct `Navigator` in the current scope
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:915:68
|
915 | global.unchecked_into::<web_sys::Window>().navigator().gpu()
| ^^^ method not found in `Navigator`
error[E0599]: no method named `gpu` found for struct `WorkerNavigator` in the current scope
--> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:920:18
|
917 | / global
918 | | .unchecked_into::<web_sys::WorkerGlobalScope>()
919 | | .navigator()
920 | | .gpu()
| | -^^^ method not found in `WorkerNavigator`
| |_________________|
|
The troubles in my branch are definitely coming from not properly migrating https://github.com/bevyengine/bevy/pull/9236 ("reorder render sets").
Someone wanting to help out might want to try to do the migration incrementally, starting there.
In that branch I did the bare minimum to get things compiling, but it seems like bevy_ecs_tilemaps
's various prepare / queue systems might need to be reworked similarly to how bevy_sprite
's did in that PR.
I've also tried and failed to update to 0.12 yesterday: https://github.com/ulfhermann/bevy_ecs_tilemap/tree/bevy012
Any progress on this?
I've started my own attempt, doing things incrementally as @rparrett suggested, right now I only got up to the commit right before the PR mentionned above, I plan to spend the day on it we'll see how far I get
Quick update : I got past this commit with some examples working, and others broken
Non-exhaustive list of examples :
- working:
game_of_life
,animation
,custom_shader
.chunking
- broken :
bench
,tiled
,random_map
I tried to compare specifically random_map
and game_of_life
examples, they seem to do very similar things, difference being that game_of_life updates tile visibility when random_map updates texture indexes but I don't really know what to do with this.
Another lead I have for debugging is the color
example which behaves strangely : it only displays 1 of the 4 colors it's supposed to display, and the color is not consistent when running the example multiple times, which suggests some issue with tiles coordinates, maybe with some z-fighting idk, might be unrelated to why the other examples are broken.
Also please note that while working on this, it seems obvious that the way this crates does things (generating meshes for chunks for optimization) should be deeply re-worked with the new way bevy does instancing in mind, but this is beyond my abilites right now. What I did was more like trying some things out and stumbling on something that half-works without understanding much of what I was doing.
Can't work on this until at least a few days but I hope my attempt can somehow help someone picking this up
Any progress on this?
Not from me, sorry. My bevy time has been spent fighting other bevy 0.12 bugs that are blocking my own projects.
Quick update : I got past https://github.com/bevyengine/bevy/pull/9236 with some examples working, and others broken
That's great!
Another lead I have for debugging is the color example which behaves strangely : it only displays 1 of the 4 colors it's supposed to display, and the color is not consistent when running the example multiple times, which suggests some issue with tiles coordinates, maybe with some z-fighting idk, might be unrelated to why the other examples are broken.
This issue is also present in your commit 131e7d3
. I believe that the chunk transforms are buggy -- all 4 "color quadrants" in the example are displaying on top of each other, and that shouldn't be the case.
Here's my incremental branch: https://github.com/rparrett/bevy_ecs_tilemap/tree/bevy-0.12-incremental
I never got "render sets" working, but my e8b3892
commit seems to be working for the colors
example, anyway.
tiled
and ldtk
are also broken in mine though.
Ah, right. tiled
and ldtk
can be fixed by adding the multi-threaded
feature to bevy in dev-dependencies
. Any app not using bevy's default features need to add this. I had hit this in another app earlier and didn't recognize it. (I think the issue with assets got fixed at some point before the 0.12.0 tag, but we still want to add this so that the examples will be multi-threaded.) https://github.com/bevyengine/bevy/issues/10209#issuecomment-1789860628
I pushed my progress in bevy-0.12-incremental
, but it's not much.
edit: random_map
and bench
are still broken / not displaying anything, I'm pretty sure because frustum culling is not working right. At least, adding FrustumCulling(false)
makes stuff show up.
edit: Okay, so the frustum culling issue was specific to my migration of the affine3a stuff. But my version also lacked a bug that eliott's had. this line should be transform.affine()
. This is reconciled in my branch now.
Just a couple notes for anyone playing along:
-
cargo-examples
is handy - text2d was completely broken for like... a lot of the bevy
0.12-dev
cycle starting at PR 9236, so some examples aren't expected to work properly until mid-october-era commits.
I'm trying this out as well. Here's a link to my branch so far: https://github.com/divark/bevy_ecs_tilemap/tree/0.12-fixes
My methodology is as follows:
- Clone the repository with the v0.12-fixes branch with the following command:
git clone -b 0.12-fixes --recursive-submodules https://github.com/divark/bevy_ecs_tilemap.git
- Open the
bevy
folder. - In a terminal, run
git bisect start
. - Run
git bisect bad v0.12.0
to mark where we want to stop ultimately. - Run
git bisect good v0.11.0
to mark where we want to stop. - Navigate back to the
bevy_ecs_tilemap
folder. - Run
./test.sh
in a terminal.- If everything compiles and looks as intended, navigate to the
bevy
folder and rungit bisect good
- If there's something wrong, navigate back to the
bevy
folder and rungit bisect bad
- If everything compiles and looks as intended, navigate to the
- Repeat 6-7 until git's bisect feature returns the commit where the error first took place.
- Investigate the steps to migrate via pulling up the PR in bevy. Easiest way to do so is to get the PR number from
git log --oneline
found in the parentheses at the end of the commit. Example:Use a consistent scale factor and resolution in stress tests (#10474)
and navigate to the URL like this:https://github.com/bevyengine/bevy/pull/10474
- Implement and commit the fixes.
- Repeat 4-10 until there are no more errors, but this time where
git bisect good
points to the PR commit inbevy
where the errors were just fixed.
Currently, I'm stuck on trying to figure out how to work around the removal of anyhow errors from this PR: https://github.com/bevyengine/bevy/pull/10003. Though, this might be a bug: https://github.com/bevyengine/bevy/issues/10350. If anyone has an idea on how to work around this in the meantime, let me know. I'd be happy to collaborate in any way to get this working as soon as possible.
EDIT: Found a workaround. Still going strong.
EDIT2: Okay, I got everything to compile, and it looks like most of the examples work as-intended. I put up a PR with these changes: https://github.com/StarArawn/bevy_ecs_tilemap/pull/489. More testing would be greatly appreciated, just in case I missed anything.
Eagerly awaiting this T.T
The Bevy 12 branch is merged in a release will go out in the next few days please let me know if you notice any issues in the meantime.
The main branch with the 0.12 changes has worked well for me. I only noticed one small performance issue that occurs when transitioning from my main menu to in-game (the point where the tilemap is displayed). For some reason it hangs in a Vulkan driver function MainCRTStartup for about 300ms before displaying the tilemap and everything else. This did not happen with Bevy 0.11, but I have no evidence that it is caused by the tilemap crate.
The Bevy 12 branch is merged in a release will go out in the next few days please let me know if you notice any issues in the meantime.
When will you release it?
I've been using the master branch (12) for a while; I also confirm that it works fine.
So far so good. Looking forward to the crate release.
How to use an unreleased package locally? Like python's pip install -e .
? So before @StarArawn help release this package, I can test it in new project.
You can specify a git dependency like
bevy_ecs_tilemap = { git = "https://github.com/StarArawn/bevy_ecs_tilemap.git" }
In your Cargo.toml
. This works as long as your project is not a library that itself needs to be released as a crate.
v0.12.0 is out now this should be fixed.
since people are piling on various issues.. i'll also add that compiling for web target/wasm is failing a bunch of different ways now. For some reason isn't getting picked up by Rust Analyzer.
871 | type ComputePipelineData = Sendable<web_sys::GpuComputePipeline>; | ^^^^^^^^^^^^^^^^^^ not found in `web_sys` error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys` --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:872:49 | 872 | type CommandEncoderId = Identified<web_sys::GpuCommandEncoder>; | ^^^^^^^^^^^^^^^^^ not found in `web_sys`
I also get these problems. I am using 0.13.0 Or is there a fix? I did not understand some comments in the thread.
bevy = { version = "0.13.0" }
bevy-inspector-egui = "0.22.1"
wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.39"
wasm-logger = "0.2.0"
js-sys = "0.3.63"
and building with this: "cargo" "build" "--lib" "--target" "wasm32-unknown-unknown"
I also get these problems. I am using 0.13.0
See https://github.com/StarArawn/bevy_ecs_tilemap/issues/516
Thanks very much. I found out, that in a clean new install, as soon as you add inspector it has these problems. So I made the inspector depending on not-wasm