Cocos Creator - Plans for C++ Components?

Hello Cocos Creator Team!
Could you tell us how you plan to implement C++ components in Cocos Creator ? Will the workflow be similar to the Javascript workflow:

  • Create a class that inherits from cc.Component
  • Define properties via macros (similar to the Unreal Engine workflow)
  • Assign component in Cocos Creator(Like the JS components)

It would be great if you could roughly describe how components will be implemented in C++ to be able to plan for the future. I really like Cocos Creator(I even learned Java Script because of that :slight_smile: ) and it would be awesome if the C++ workflow would be similar(Of course longer compile times and other things that are C++ related but it if is easy to create new components with serialized properties in C++ that would be great!

2 Likes

Hey, I’ve asked a similar question in this thread:

Looks like there are no plans to mirror the JS EC system in C++ for the time being.

Thanks for the information! Would be sad if there is no possibility to create C++ components but maybe that will be added later…
I was experimenting with an ECS in combination with reflection in C++ which worked quite well. For reflection I used https://github.com/billyquith/ponder which makes it easy to define properties and serialize them.

For ECS there are also many useful open source libraries like https://github.com/alecthomas/entityx but creating a basic ECS from scratch is also not too much work as far as I know(A simple system similar to the existing JS ECS). But I don’t know how hard it would be to combine the existing JS components and C++ components, I guess that is one of the main issues.

1 Like

@Nightmare_82 you could check out https://github.com/NatWeiss/EntityFu for a simplistic entity system.

1 Like

@stevetranby Thanks, looks very good!

Thanks guys, all very good examples for Entity Component System in C++.

Currently it’s not our priority to verify C++ EC with Creator, but maybe it will become important in the near future, we are open to the possibility.

Let me loop @zhangxm @jare @nantas in

EC is good, but it will make a big change to cocos2d-x. Currently there is not plan for it.

OK, thanks for the information!
Could you please tell me briefly about the biggest problems to implement EC ? In the current Cocos2D-X C++ version nodes can already manage custom components so I guess the biggest task would be to make it possible to define properties in C++ that can easily be serialised and edited(In Creator), right ?
For that solutions like https://github.com/billyquith/ponder could make it easier.(C++ reflection library)
But it’s definitely not an easy task but it would be great if somewhere in the future this could be achieved.

When the basic C++ support for Creator is ready I could also take a look at that if you want.

1 Like