Hey
I am currently working in team trying to create dungeon crawl like game. It's using WebGL, 3rd person view and 3D calculations and stuff.
As usual, game board will be divided into square tiles. Each tile having some Position and Display component in essence. I would like to have one RenderSystem that can handle rendering of entities based just on those mentioned components. It will render tile floor, wall, some torch on that the wall, web in the corner and so on.
Now let''s say that level size will be rather huge, could be even like 10M tiles with 500 torches in total. That's a lot of entities. However it will be a lot about light and shadows so only small portion of map is currently visible to player. There will be LightSystem making these checks and adding/removing "Visible" component to/from particular entities. And here I am getting stucked a bit. Performance issues.
As I am rather newbie game developer, I am probably missing something totally obvious. Currently it looks like, that during each update I have loop through all entities and check, if those are visible to player. I can imagine, that it could be limited just to entities with Tile component. However I am wondering it's ok, to keep dynamic array of entities, that are in that component. It's really bad habit and thinking blocker from OOP. From what I have read here, it's not really recommended to have entities list kept elsewhere.
Anyway even if it would be allowed, it's still 10M tiles to check. I could imagine some spatial indexing for OOP approach. For ES it's quite foggy imagination as the nodelists are component driven, There is no possibility to keep list of tiles based on X/Y coordinates.
Can someone push me in the right direction please ?