Skip to content

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

Open
@alice-i-cecile

Description

@alice-i-cecile

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-DocsAn addition or correction to our documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions