bevyengine / bevyengine/bevy

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

Open
#7,958 1 comment 6 reactions 0 assignees View on GitHub
A-ECS C-Docs
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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

https://github.com/bevyengine/rfcs/pull/68 will make working with and defining methods on the `WorldQuery` derive much nicer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.