Ok, now, let’s get the new and funny experiment going…
Do you use Unity?
If yes, well, the idea behind the models, and behaviours, joined between scenes looks cool and promising, but…
What if I tell you there is a probably cooler way to work with?
Here I will talk about the alternative, similar yet different:
How does it work, well, let’s put it simple.
We will think all of our usual models just entities, entities are that, a player, a tree, an enemy, everything you could think of it as a “model” by the MVC, is valid.
Except when it’s not. An entity doesn’t have any properties, but it behaves more likely a bag of components.
Components are small bits of models, for example, a component for position may only have and x and a y as numbers, a sprite component may have a file attached to it.
And so on.
But you say, where is my game logic then?
And here is where the system appears.
A system is well, it takes a list of entities, and makes some processes on it.
For example, a movement system needs to have both entities with position an acceleration, or a drawing system must be all entities with an sprite or background attached, and so on.
You could think your entities are static, but the real power of this comes when the entities allow to add or remove components on the fly.
Yes, imagine this, you are playing an rpg, and your character gets petrified, then you just remove the “ActingComponent” of your Entity “Player” and then, the system automatically excludes your player from acting.
Also, you may want to disable entirely a system, imagine your character suddenly goes into space.
You just need to remove the “GravitySystem” and everything will run smoothly as you may expect.
Other alternative would be, if you have an “InputSystem” for “ControllerComponents” you could convert AI characters into playable characters and back to AI characters, by adding and removing this “ControllerComponent” from them.
This will make your life a lot easier to code, believe me.
At first I was confused, a lot, it looks confusing, but after a while it gets a lot simpler.
The difference between this system and the monolitic behaviour of Unity, is than here the true pivot of action is not the GameObject itself (or the entity), but the responsibility goes to the system instead.
Both alternatives have the ability to be really usable on game development, and both are entirely dynamic, you can attach or remove things from a game object, but nothing coordinates them by itself. Here your system are unique and shared among data.
So it may consume less memory, sometimes.
The disadvantage is of course, having to update a lot of systems may cost some performance. But as an Indie developer I don’t mind much, your game usually has processing power for this.
Another good thing, is than system could run in parallel, yes, parallel programming.
One should be careful of this anyway, because you know, race conditions and such.
Again, tools are tools, each has it’s uses, but if you ask me it’s like perfect for RPGs, and tactical games.
Probably a platform game won’t benefit much from it, still a platform game could be done this way.
If you want to really learn more, I suggest you take a look at Ashley, by far it’s simple to get what they try to teach probably a lot better than myself.