I’ve got a game that has some pretty complicated collision algorithms and draw prioritizing (to make texture binding happen in a happier order), and as a result I ended up with 5 different lists that all do basically the same thing except they keep the groups organized for collision checks and drawing ordering. Can anyone think of any ways to make this a little bit better? This is basically what I’ve got:
EntityTypeA - Collides only with type A (and pathfinds only with A’s), also drawn in 3D mode so some OpenGL flags get set before drawing, not ordered.
EntityTypeB - Collides only with type B and does some other B-related logic, ordered by Y position (game is isometric).
Particles - All the particle effects go into this layer. They don’t collide with anything and are ordered by their texture id.
Emitters - All the particle emitters go here - they do absolutely nothing special except emit particles. They are not drawn, but can be attached to an Entity separately (which means they aren’t in this list).
LevelGrid - a 2D array, contains all the different spaces in the level, links to other spaces ( ex. (0,0) might not link to (1,0) if there is a wall), and some Object inside, could be null (if the space is empty) or any Entity (an inactive Entity goes into one of these spaces).
The question is if there is a better way to do this. I need to keep the groups discrete from one another but repeating the exact same for loop with 4 different lists is pretty annoying, and I am thinking of adding yet another list.
Ideas?