Cocos2d-x vs Cocos2d-JS vs Cocos2d-Lua

Hello everyone. I’m new in this forum and new to game programming too. Cocos2dx caught my attention because of its popularity, its free license and some books published. I plan to start creating some minigames and release them as open sourced to help the community. By the way, do games coded with Cocos2D-X have the same performance of games coded with Cocos2D-JS / Cocos2D-Lua? Thank you :slight_smile:

For the most part yes, you don’t need to worry.

Just use which ever you prefer in terms of language. Just note that Cocos2d-x has more documentation ATM but Cocos2d-JS is rapidly growing in popularity and will most likely be the most popular soon.

You need to know something about the structure about cocos2d-x.
FYI: There is also cocos2d-html5 which is a implementation of the cocos2d-x engine for the web. I don’t talk about this one in the sentences beneath.

There is the cocos2d-x engine which is written in C++.
You can use the cocos2d-x engine to write apps in C++.

You also can use Lua or JavaScript to write cocos2d-x apps. These language use special bindings which connects the Lua and JavaScript commands to the cocos2d-x engine commands. Remember: The cocos2d-x engine is C++ (that means as fast as cocos2d-x could get). So you are having the overhead of using these bindings. FYI: The overhead of the bindings is really small.

If you are using Lua and JavaScript and you code a lot of logic, which could be really heavy than you could get performace problems because you aren’t using native code.

To sum it up: cocos2d-x C++ is always a bit faster than cocos2d-x+js and cocos2d-x+lua. And it also depends on your game. If you calculate hardcore stuff than C++ may be faster.

PS: You could also try to write the heavy stuff in C++, create own lua/js bindings and use lua/js. So you can minimize the performace gap if you really have performance problems.

Foresighted! I have a very similar feeling from the growth of cocos2d-js.

1 Like

walzer are you hinting at something :smiley: