3mcd/javelin

Question: Can I store entity id in a component?

Closed this issue · 1 comments

I'm storing tilemap data using the Tile component, and treat them as a list to render them, this works fine.

But if I want to run A* routing algorithm on the tilemap, I have to treat them as 2D array again, but the entity list is a 1D array now...

So I'd like to put a number field in the component to store 4 entity ids, which is in the NSWE of this entity.
So in the map system, I can use this information to reconstruct the 2D tilemap array.

Is this approach OK?

3mcd commented

Yes, that's perfectly fine. That sounds like an interesting problem to solve! I'd love to see the code when you get a chance.