Handling of entities

So as the topic says, what’s the “smartest” way of handling entities?

Currently I have this setup(Which I think is rather silly):

Screen
-> List of entities in the screen
-> Each entity has it’s own list of entities that is spawned
-> etc. etc. etc.

I’m considering just passing a reference to the Screen to each of the entities, and then they can slam their own entities into the Screens list of entities.

The more I’m considering this, the more it seems like the better idea to just have 1 big list with all the shizzle in. (And much more memory efficient, I assume)

… Actually, is there any reasons why I shouldn’t just slam it all into the Screens list of entities?

(Seems like everytime I’m asking a question in here, I make up my mind on the matter while typing out the post… :P)

well if it is a simple game one list should be perfectly fine. Atleast that has been my experience :slight_smile:

In my game I am using one list with some “helping” variables like display order and it works very well, so I think your way to handle entities is rather good.

I always used one list. My games haven't got such a huge amaount of entitys.
Therefore I've got an Entity.class, and for exampe PlayerEntity.class that extends from entity etc.. Now I use [cod]if([entity] instanceof PlayerEntity)

to do sth with it.
best regards