Okay so i'm making a top down classic styled RPG using SFML. But i have a question, and i only ask because yes I've done some googling and either its a stupid question or i cant find the right keywords.
So about a week ago now i discovered Entity Component Systems, and its variations and i fell in love with the structure. So i built a test program to see if i liked it. and i think 2 days of reading articles and then 3 days of programming later ive got a game that functions exactly the same (the bare basics, a player and a world that the player moves on) Nothing super fancy, but i like everything so far
For reference ill just describe what i have, hopefully that'll help answer my question that ill write in a second.
-So ive got an Entity class, that's got an id and a vector of Components.
-Comonents are added as needed to each entity. Originally each Component had data and an update function that messed with its data when it needed. I later moved the contents of the update function up to the System Managers after reading some more articles, (i might revert back to the original, not sure witch way of updating the components i like better) Examples of some Components are Physics, Input, Graphics.
-Then I've got System managers that manage updating for its component type
-And lastly a Manager that holds the System Managers and any other variables i need stored there like my RenderWindow
I'm still tinkering with it, but i like this a lot better than the traditional OOP approach. However there's one problem (lol it could totally just be an issue of me overthinking) that's arisen. So every entity is functionally the same, its the components it stores that make it into something different. So back in OOP if i wanted to create a Player for instance, id probably have to make a player object, and then just create an instance of it. Now if i wanna make a Player, i make a new Entity, and add all the appropriate components, creating any new components as necessary. So my first question is should i define each new type of object i need in some form of file(if so what type would be best) or should i just manually code them in as needed somewhere in a System Manager or something? Im not really sure if this makes sense -.- let me know if im just rambling or if some part of this didn't make sense!
I also had another question but forgot it while typing this oh well, maybe it'll come back to me later.