I am asking this question purely out of interest, and hopefully you guys can point some interesting links my way. I am a relatively new C++ programmer. I feel I have the basics down pact, but it is actually putting them all together in a software project that I find very very very very hard.
So I am making a 2d space ship game and came across ECS via this forum. I was intrigued by the concept and ended up using entitiyX in my game. The game is quite simple now (just the player ship, and some enemy ships that shoot at the player) and I am still learning how to properly use entityX to achieve my goals.
To be honest I am now coming to think of ECS as almost a 'convenience game API' for noobs like me that want to do all the stuff a game should do, but can't program it. For example I made it so my spaceship could shoot a spell, a fireball. To do this I created a SpellSpawner component (the invisible 'thing' I assign to entities that can shoot spells), a Spell component (the actual spell that is created), and the SpellSpawner System (the system which implements the spell logic). The main bit of the logic reads
for (entityx::Entity entity : entities.entities_with_components(position, spell))
which allows me to use those entities that have position and spell components,I then create the fireball entity with
SpellCreator(entity.id(), initVelocity, spellPosition.position, spellPosition.heading, spell->spellType, Colors::Orange).create(entities.create(), nullptr);
which creates my spell entity, and the spell 'moves' because it has components motion and position,and is picked up by the MovementSystem. Collision will also be taken care of because the spell entity has a collidable component. I now plan to add that an enemy ship goes on fire if hit with a fireball, or is frozen and slowed if hit with a ice bolt, and feel I can do this quite easily just with adding or removing components on the fly...
Now I have had a peek at the entityx source code.. it is some serious looking stuff, I have no Idea what is going on. (this probably applies to any ECS framework)....
So finally to my question, roughly how would I achieve the same sort of behavior (as in this spell example), without using ECS. From my readings on the forums, there are still Systems, which process the game logic, but how do they pick up what has to be done? And it seems 'entities' still exist, but not so much as an ECS entity, just a 'game object entity'. Basically what do the systems process, and how do you program this kind of flexibility? How do I create my 'spells' on the fly like this? It does seem like ECS by default is nicely decoupled as game code should be (I can comment out any one of the systems and the game will still run, just without that systems functionality..). Again, do the same concepts hold for non ECS game code?
I plan to program this same 'example scenario' without using ECS, hopefully to make me a better programmer. As amazing as it is for games, I feel it is not actually improving my programming, and makes everything 'too easy'. And yes I do want to program a game, but with the primary objective of learning C++.
Thanks