I’ve been searching for weeks for a good game design and architectural approach. I need a great way to manage entities without having to loop through everything.
I’m developing a Real-time Strategy and I have been trying to figure out how to have the entities communicate and attack without having to loop through everything. I am using a grid manager where every entity is in a cell, then I select all the entity’s neighbors to determine who to shoot. However, if there are a total of 50 entities in the nearby cells, and I have them all loop over each other and shoot, the game begins to lag. I’m trying to find an approach that doesn’t utilize too many loops.
I have read many articles but so far none give a clear answer.
Please don’t mention using an entity manager like Artemis, because I would still have to loop through everything.