Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bevy 0.15 #340

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

bevy 0.15 #340

wants to merge 14 commits into from

Conversation

alxgnon
Copy link

@alxgnon alxgnon commented Dec 5, 2024

I've been watching progress for bevy_ecs_tilemap's migration to 0.15. It isn't quite ready yet but I decided to start making the required changes for bevy 0.15 in this repository.

For this branch, The examples aren't quite fixed yet. Also I'd like to fix up the LdtkProjectHandle thing a bit better. But the base library compiles so I'd say that's a good start.

@neocturne
Copy link
Contributor

neocturne commented Dec 8, 2024

@alxgnon Nice work! I've done some improvements based on your branch: https://github.com/neocturne/bevy_ecs_ldtk/tree/bevy-0.15 and got all doctests and examples to run (although I haven't tested the examples very thoroughly so far)

TODOs I'm aware of:

  • rapier2d currently uses a temporary PR branch, must be updated once Update bevy to 0.15 dimforge/bevy_rapier#595 is merged
  • Needs doc updates and migration guide
  • Evaluate moving from Bundles to more idiomatic required components (probably better left for a future PR)

Bevy now warns about missing Visibility components breaking propagation.
Fix a few places I noticed.
@undrscor
Copy link

undrscor commented Dec 9, 2024

Hello, im a rookie rust developer here, I was playing around with bevy_eck_ldtk to make a small 2d platformer game and took a small break, recently came back to to it only to find a new version of Bevy (0.15), with a bunch of new errors and issues in my code. Is using bevy 0.15 viable with the current released version of bevy_eck_ldtk? Obviously ill need to do a bunch of migration actions, but I want to make sure im not doing them in vain if this library wont work at the moment anyways. Otherwise ill simply roll back to bevy 0.14 and continue from there, since I do have a deadline for this game. Thank you in advance, and also im a huge fan of this project, its been super fun and useful!

@neocturne
Copy link
Contributor

@undrscor At the moment, Bevy is still in an "early development" state, where each major release is a breaking change, and all plugins need to be updated to be compatible with the new version (and become incompatible with older versions). The currently released version of bevy_ecs_ldtk is for Bevy 0.14; this PR will add support for Bevy 0.15 when it's done.

@undrscor
Copy link

undrscor commented Dec 9, 2024

@neocturne Thank you for the quick response! I'm really excited to see support for Bevy 0.15 being added.

I'm just starting out with both Rust and game development, so I'm still a rookie, but I'd love the opportunity to contribute to this project if that's at all possible. I'm not experienced with a lot of concepts applied in this, but I would be happy to try to understand and help with any smaller tasks that you feel like sharing.

@alxgnon alxgnon force-pushed the main branch 2 times, most recently from 637b84f to a55b10c Compare December 9, 2024 22:48
@alxgnon
Copy link
Author

alxgnon commented Dec 9, 2024

@neocturne I went ahead and included your commits in the PR. I'm still unsure about what I did with LdtkProjectHandle. Perhaps there's a cleaner way but I don't know. I'd love to hear your thoughts! Otherwise, I'm pretty happy with this! Once bevy_ecs_tilemap releases in 0.15 I hope we can move towards getting this merged!

@alxgnon alxgnon changed the title WIP: moving towards bevy 0.15 bevy 0.15 Dec 9, 2024
@neocturne
Copy link
Contributor

Regarding the handle, the current newtype solution seems fine - I've also seen the pattern in other plugins. Adding a derive for Deref would allow to revert a lot of the code changes where the handle field is accessed. With Required Components, the type might be called LdtkWorld instead of LdtkProjectHandle, as it could replace the LdtkWorldBundle as the "driving concept" component.

An alternative would be to merge LdtkProjectHandle and LevelSet into a single component, but that seems less convenient to use when you don't want to interact with the LevelSet directly.

Another thing I was wondering about is whether the #[sprite_sheet] attribute should be merged into #[sprite], instead distinguishing the cases by a new argument, as both apply to a Sprite component now.

It would be good to get @Trouv's opinion on these questions, as they are the maintainer (and we should get them resolved before updating the book / writing the migration guide).

@alxgnon
Copy link
Author

alxgnon commented Dec 10, 2024

I managed to get the Deref coercion working in my latest commit. I was able to revert the changes where the project handle is used. No more handle.handle!

@JosefKuchar
Copy link

Bevy 0.15 support for bevy_ecs_tilemap was merged. Is this is ready?

@alxgnon
Copy link
Author

alxgnon commented Dec 15, 2024

I replaced my fork of bevy_ecs_tilemap with the 0.15 release version

@alxgnon
Copy link
Author

alxgnon commented Dec 16, 2024

@JosefKuchar All that's left is for @Trouv to get back to us and to update the documentation once everything's decided. Though you can probably just use my branch as a dependency in the meantime.

@Trouv
Copy link
Owner

Trouv commented Dec 16, 2024

Thanks for your great efforts on this, everyone. I'm finally catching up

With Required Components, the type might be called LdtkWorld instead of LdtkProjectHandle, as it could replace the LdtkWorldBundle as the "driving concept" component.

I like the idea of embracing Required Components here. I'm okay with the name remaining LdtkProjectHandle though, as the concept of a World has been adjusted in LDtk since I originally named it (now technically multiple ldtk worlds could be spawned with a single world bundle).

An alternative would be to merge LdtkProjectHandle and LevelSet into a single component, but that seems less convenient to use when you don't want to interact with the LevelSet directly.

My instinct here is to keep them separate. In my imagination, most use cases mutating the level set will not be mutating the handle and vice versa.

Another thing I was wondering about is whether the #[sprite_sheet] attribute should be merged into #[sprite], instead distinguishing the cases by a new argument, as both apply to a Sprite component now.

Actually, in the past I've gone so far to consider deprecating the #[sprite] entirely. I think you're right that the correct design that keeps both macro behaviors would combine them. Something like like #[sprite(no_atlas)]? However, I'm okay merging and releasing a version that doesn't have this improvement to get bevy 0.15 support out there sooner

@alxgnon
Copy link
Author

alxgnon commented Dec 16, 2024

I like the idea of embracing Required Components here.

I'm not sure how to do this, since Handles cannot be used as components in Bevy 0.15 onward.

I'll go ahead and update the docs and create a migration guide so we can get this merged.

@Trouv
Copy link
Owner

Trouv commented Dec 16, 2024

I'm not sure how to do this, since Handles cannot be used as components in Bevy 0.15 onward

What about the new type LdtkProjectHandle?

@alxgnon
Copy link
Author

alxgnon commented Dec 16, 2024

Oh yeah, I suppose LdtkWorldBundle could have its components as required components instead of struct fields, though maybe that would be for a different pull request.

@Trouv
Copy link
Owner

Trouv commented Dec 16, 2024

Yeah that's fine. Happy to get something working for 0.15 released and make subsequent improvements to it

@alxgnon
Copy link
Author

alxgnon commented Dec 16, 2024

@Trouv I've updated the existing documentation and I added a migration guide for the new version.

@alxgnon
Copy link
Author

alxgnon commented Dec 17, 2024

@neocturne I figured you'd like to have a look as well, since I documented your changes in the migration guide, too.

Copy link
Contributor

@neocturne neocturne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the doc changes and migration guide look good, I only have a few nits.

book/src/explanation/game-logic-integration.md Outdated Show resolved Hide resolved
@alxgnon
Copy link
Author

alxgnon commented Dec 17, 2024

@neocturne I pushed some changes to resolve the points you brought up.(!)

@alxgnon
Copy link
Author

alxgnon commented Dec 18, 2024

@Trouv This is probably ready to get merged & released as 0.11 (unless you have anything else to add)

Copy link
Owner

@Trouv Trouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran the CI and there is some clippy and mdbook failures (apologies that it doesn't actually mark this job as red when it fails). I think many of the code examples in the old migration guides need to be marked ignore instead of no_run. I should have just marked them all ignore in the first place after I wrote them and verified they worked.

Otherwise, code looks good.

src/components/mod.rs Show resolved Hide resolved
@alxgnon
Copy link
Author

alxgnon commented Dec 18, 2024

Alright, I added the documentation you wrote. I also added the changes clippy was asking for. I didn't see any failures on the mdbook side, at least not in the CI run results.

@alxgnon
Copy link
Author

alxgnon commented Dec 19, 2024

@Trouv Okay I see what you mean now by the mdbook errors. I totally glanced over them since it was green. I added rust,ignores where there were test failures, and got mdbook to run successfully.

@alxgnon
Copy link
Author

alxgnon commented Dec 21, 2024

@Trouv Okay, should be good, now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants