I just need to do a quick sanity check on the idea that is in my head for the code structure of my next game. Here's what I'm thinking,
Game objects will hold nothing but data, and only the data for the components they need. Eg an enemy will have a movement component(with position, movement direction, velocity, etc. and a ref the the ONE movement handler that operates on all gameobjects with a movement component), a controller handler(for the enemy this would have data relevant to the decisions its ai will make and a reference to its specific AI controller, of which one only exists and which controls all ai of this type.(if it were a player it's controller would point to an input handler instead of ai), a graphics component with its sprite info and a reference to the same gameobjects position component, as well as a reference to the games graphics handler which renders everything with a graphics component.
the main loop would loop through all the gameobjects that need updating and call their update function, and in each objects update function it would loop through its components and call their update function. the components update functions would pass itself and its parent gameobject to it's respective handler object so the handler could perform all the updates it needs to.
Thats just a general explanation of the general idea I am considering right now. A spinoff would be if each object was registered with the handler itself, then in the game loop I looped through all the games handler objects and for each handler object I looped through every object registered with it and did everything needed to be done to each object every frame.
Do either of these ideas make sense? Can you help me improve upon them, or suggest a better way? Any advice that will help advance my understanding in any way? I'm still somewhat new to games a programming so I'd love any responses that help me learn something.
Thanks guys.