u/77fill

▲ 16 r/bevy

Components vs Resources

Hi, I'm new to game development and bevy and I have a question.

Imagine you have a tiled world with a path / road and you need to know the neighbors of the road tiles and similar information.

Would you use a component like 'Neighbors' or would you create a resource with a hashmap?

What if you want to save the location of some people in the world?

I looked at the bevy minesweeper tutorial on devto and the author used a hashmap for the covered tiles (coords -> Entity).

Maybe it's faster that way? Should be O(1), but what about querying with a system? I guess O(n) - it needs to go over all component sets, right?

Now that I think about it, couldn't you just get rid of the components and use resources instead

reddit.com
u/77fill — 1 day ago