sure, what your game is and what your needs are greatly effect how your engine needs to be built.tokumaru wrote: ↑Wed Sep 04, 2024 8:13 pmThat's an interesting idea, but as games get more complex, I think it's more likely that the order of updates will matter (e.g. a moving platform may need to be updated before entities that are riding it), and that entities will reference others via their slot indices (e.g. objects being carried, multi-segmented objects, etc.), so I wouldn't recommend this approach.Oziphantom wrote: ↑Wed Sep 04, 2024 11:06 amFor entities you can do a "compacted array" as the order of update doesn't usually matter. so what you do is you keep an index of which is the last one, and then when you remove an entity you copy the last data into the slot you are removing and then decrement your "last entity" counter.
For example if I'm making a shoot-em-up that is vertical or horizontal scrolling, then I would make the entities a circular buffer and just disable dead entities as they are going to be moving left to right/right to left/up to down/down to up etc for the entire level and there will be a lot of them, that spawn and die fast.
For things like forced update order I generally prefer to make it explicit, but then I usually design for machines with 64K(+) of RAM, it would be less practical on a 2K system.
For player carrying I would make the world and held entities be different, so the world get removed and then a held gets made but it is owned and updated by the player and is not in the entity list. But again stylistic choice/what does a carried object need to do in your game.