How to limit boilerplate when trying to maintain consistency in the world ? #20105
Replies: 2 comments 1 reply
-
You can use type aliases:
this also promotes reuse. Another example then:
|
Beta Was this translation helpful? Give feedback.
-
I don't know enough about your game but this combination of filters feels weird to me. Do you sometimes spawn tiles without Your system adds components to newly spawned entities. There are one issue with doing it this way. There will be a latence between when a tile is spawned and when it gets all its components that you will have to handle with some ordering. I would say a hook or a one-shot system is better suited for this. As for grouping |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Preface: I am a bevy beginer, so I might be doing some crazy things.
I am trying to make a game with a grid of tiles. These tiles can be identified with a 2d coodinate.
When a tile is added to the world, there are two things that should be done and I am currently using the same solution for both.
Small description of my data model. I have the following components that can be added to a Tile entity:
Right now I am keeping track of new additions with a system in the Update schedule. So the contract of the system function is (here for the sprite-adding-system):
This works, but I feel like this pattern can get dirty quickly, this is why I am asking for your feedback.
Specifically, it is really heavy to have to use many Or<Added<...>,...> and With<...> to be really sure that the state will be correct no matter in which order the components were added. If I need to do that for large bundles, that code is going to be huge.
Additionnal remarks/questions:
Beta Was this translation helpful? Give feedback.
All reactions