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

Add an example to demonstrate patterns for ECS code reuse and abstraction #7958

Open
alice-i-cecile opened this issue Mar 7, 2023 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation

Comments

@alice-i-cecile
Copy link
Member

How can Bevy's documentation be improved?

There are a few important patterns that can be used for writing reusable, more abstrated Bevy code.

  1. Generic systems (already has an example).
  2. Methods on component and resource types.
  3. The SystemParam derive.
  4. The WorldQuery derive.

The second often makes beginners nervous (seperate your data and logic!!), while the latter two are hard-to-discover, full of irrelevant unsafe and tricky to figure out how to use.

We should have an example demonstrating how and why to use these tools, in a moderately realistic setting. For methods, I'd demonstrate encapsulation, maybe with a nice validated setter pattern.

This should be covered in more depth in the book, but for now I think a short example would serve as a nice breadcrumb.

Additional Context

bevyengine/rfcs#68 will make working with and defining methods on the WorldQuery derive much nicer.

@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events labels Mar 7, 2023
@deavid
Copy link

deavid commented Mar 7, 2023

It would also help if the SystemParam and WorldQuery trait docs had a Description section that attempts to sell itself to newcomers. Answering questions like "Why would I use this?" "Why a game needs this?" "What kind of problems does this solve?"

These two traits and their derives would be useful to have mentioned and covered in official tutorials and books, even if lightly, just to demystify their usage and show that this is not some sort of internal stuff, but intended for games to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation
Projects
None yet
Development

No branches or pull requests

2 participants