Actually we have components in v3… although they are not finished.
Finishing what was started is rather easy… we just need to add a few callbacks to let people extend Nodes from JS / Lua. That is what @minggo did.
And I don’t want to change that in v4… In fact having the possibility to extend Nodes in JS and Lua is a good thing. So, I don’t want to change that interface.
But we need a complete ECS, not because it is needed to extend Nodes (we will have that in v3.8), but because we need a modern architecture to improve the performance.
An also it is a question of “time-to-market”: Doing the v3.8 approach is quick, easy, with little or no risks.
Implementing a complete ECS inside cocos2d-x will take time and it is very complex. We have to do it carefully.
Basically I want to refactor the scene graph and remove all the “logic / code” from it, and put it in “systems”.
CCParticleSystem has the logic of the “system” in the Node… that doesn’t scale well.
If you have 200 particles, you will have to execute 200 systems (you have to visit 200 nodes)… and that is not efficient.
If we move away the Particle System code from the Node into a stand-alone “Particle System”, then a lot of optimizations could be done like:
- data locality, to avoid CPU cache misses
- parallelize the execution of the system… perhaps 2 threads, or more can execute it… or the Particle System could be run in parallel together with another System.
So, that is what I want to do for v4: Have more Systems, and less “code” in the Scene graph.