Comments (4)
Yeah I knew this going into it. I wanted to illustrate the pattern of breaking up a "traditional" data structure into its core pieces (in this case the Person marker component and the Name component). I think including another system with (&Dog, &Name)
would help illustrate the reuse and the value of the marker components. In this case, including "Person" in the query ensures we only run on entities with (Person, Name) instead of any entity with Name.
However in practice to suppress the "unused variable" warning and reduce the amount of data accessed, we would actually write the query like this:
Query<With<Person, &Name>>
That runs on the same dataset, but only iterates over the Name components. I didnt use that approach because I didnt want to over-complicate the query with With
that early in the book.
I can definitely see how this is confusing. If you have suggestions let me know.
from bevy-website.
If you have suggestions let me know.
I think you answered it yourself!
In this case, including "Person" in the query ensures we only run on entities with (Person, Name) instead of any entity with Name.
Maybe there is an opportunity here to show this in the tutorial. I personally have a "break things to learn things"-approach and find it very powerful and I feel like the tutorial is written with this mindset too.
So maybe introduce this "bug" by declaring an entity with a name component which we don't want to greet!
EDIT:
I just tested it by introducing a Dog entity and then querying just the name mut query: Query<&Name>
and like so mut query: Query<(&Person, &Name)>
and it does exactly what is expected. I think this little addition would be helpful to understand the quasi relational aspect of your system.
from bevy-website.
I don't think there is a real issue here. It seems pretty clear in the book, to me. But, if clarification is needed, I do see two ways to clarify this. First, is to add the Dog entity, as already mentioned. The second would be a little more specific:
The parameters we pass in to a "system function" define what entities the system runs on. In this case, greet_people will run on all entities with the Person and Name component.
Could be...
The parameters we pass in to a "system function" define what entities the system runs on. In this case, greet_people will run on all entities that have both the Person and Name component.
And for queries:
Now our App should properly greet all People, once every two seconds!
Could be...
Now our App should properly greet all Persons that have a name component, once every two seconds!
from bevy-website.
Closing out; this is no longer how our syntax works :)
from bevy-website.
Related Issues (20)
- Missing link to "better scenes" document under what´s next? HOT 1
- Observer-hooks ordering isn't quite correct
- Migration guide should note that OnEnter states are now run before Startup
- Move notes about disabling logging from setup to book HOT 1
- Changelog and contributors tools can fail to find PRs HOT 1
- Migration guide: Event implements Component HOT 3
- Migration guide: incorrect recommendation for bevy_app feature HOT 2
- Bevy 0.14 news post has broken URL for Working Groups
- Automatically run pngcrush on example screenshots HOT 1
- Migration guide: Missing Plane3d -> InfinitePlane3d HOT 1
- Write about how to reduce Wasm binary size HOT 2
- Migration guide corrections HOT 3
- Recommend cranelift on macOS
- A broken URL which lead to a 404 in the quick-start learn page. HOT 1
- 0.13 to 0.14 migration guide didn't mention `insert_gizmo_group` HOT 3
- 0.13 to 0.14 Migration guide: Mention that RenderLayers is no longer Copy
- Many examples are missing screenshots HOT 2
- Examples link to old URL, causing multiple redirects HOT 2
- Bevy 0.14 release notes reference "custom_winit_event" example but it does not exist HOT 1
- The "Quick Start" is a bit of a mess
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy-website.