Will Cocos2d-JS replace Cocos2d C++?

I’ve read that the JS version of Coco2d is for “rapid game development and game prototyping,” but does this mean that the performance of games made with Cocos2d-JS with JSB will be worse than a game made with Cocos2d C++? Is the future of Cocos2d JavaScript?

Performance of games made with Cocos2d-JS with JSB vs a game made with Cocos2d C++ depend the way you use,
If game need performance for logic, cocos2d-JS will be worse than, otherwise cocos2d-JS same cocos2d C++.

I don’t think cocos2d-x C++ will be replaced with cocos2d-js because cocos2d-js is just the extension of cocos2d-x C++ which need cocos2d-x C++ source to run and also there are a lot of things that javascript couldn’t provide.

Cocos2d-js performance is actually really good on native platform. But it can replace C++ version because JSB still need C++ core!

JSB performance is lower than C++ performance where… Surprise! Where is Javascript used.
So if your game has some more game logic than 1 + 1 you will have performance issues. Sure you can bind your login to C++ and this is a power of C++ + JSB.

I know right … because of that reason, I have decided to use C++ + JSB. The C++ side for the game logic and JS for UI or some specific mechanics.

I’m sure this is the best use-case for JSB.

Hello @igormats @wiwing
Can you give me more detail about (JSB + C++), and why u say that JSB performance is lower than C++ performance? I lauched both Cpp-Test and JS-test (3.8.1) found out that they have the same performance (test on ip4 :))

Here’s an article that just lists the performance of C++ and JS.

First of all, as I’ve stated before that JSB needs C++ core to work properly means that there will be overhead for each object created in JS because it will also allocate object in C++ thus it will perform two memory allocation for both JS object and C++ object. Even though it doesn’t matter when you only create several JS objects but when you’ve created thousand or million of objects, obviously it will affect the performance especially the memory.
Other things are game logic require complex computation and algorithm, something like moving objects, check collisions, AI, pathfinding, etc. which sometimes will be slightly faster to do it in C++ and you can also use multithreading in C++ (since I’m not really sure if there is multithreading support for available scripting languages)
Maybe you could also check this post for further reading.

I suggest you to mix both C++ and scripting (JS/lua) just like I’ve mentioned above, use C++ for most of the game logic, complex computation, data allocation and networking things, and scripting for UI/View and specific mechanics (i.e. units’ skills, mathematical formulas, etc.)

1 Like

There are no plans to replace -x with -js.