doonv / bevy_dev_console

Source-inspired developer console plugin for the Bevy game engine.
Apache License 2.0
112 stars 10 forks source link

Entity Queries #3

Open doonv opened 8 months ago

doonv commented 8 months ago

Currently, you cannot access entities properties. In order to access entities properties we will need entity queries. Entity queries will be a built-in parser feature that will allow you to query the entities you choose and modify them.

Design

Todo list for the design of the entity queries.

Implementation

After the design has been finished, we can start the implementation.

nicopap commented 7 months ago

I've designed a DSL for querying here https://github.com/nicopap/bevy_mod_dynamic_query/tree/main/examples/query_interpreter#query-grammar if you need some inspiration. You can always re-use the bevy type DSL though.

doonv commented 7 months ago

That looks cool, How will I go from the regular built-in parser to the DSL though?

nicopap commented 7 months ago

I mean, you write a grammar that supports the rust syntax. The full parser for both syntax is defined here https://github.com/nicopap/bevy_mod_dynamic_query/blob/149b5d4a5a3611373b99b83bc9075cbd7d03b01e/examples/query_interpreter/src/query_parser.rs. Similarly to video game FX, no need to support all the intricacies of the rust syntax, it just need to look like it :P

doonv commented 7 months ago

I meant something like $( insert query here ).MyProperty = 5.4. The $( ... ) transitions from the built-in parser's language to the Querying DSL. I kinda like the $( ... ) syntax what do you think?

nicopap commented 7 months ago

Always can use a keyword that it a rust keyword, so that you are sure to avoid overlapping with pre-existing field names. For example for ( bindings ) in <query> { … }. Or terser yet: for(<query>).… (yield?). I also like the functional style, swapping for with map.

doonv commented 7 months ago

@nicopap I'd like to use your bevy_mod_dynamic_query library for this, and I have a few issues with it. but it looks like issues are disabled. Can you re-enable them?

nicopap commented 7 months ago

Issues are now re-enabled on bevy_mod_dynamic_query.

doonv commented 7 months ago

Thanks!

doonv commented 7 months ago

Ah turns out my issue is actually not a problem.

doonv commented 7 months ago

This is currently blocked by either of the following: