Different between using js and c++ for developing mobile game

I pretty good with js, it’s really hard to use C++ and i wonder what different between these two? Cocos will compile js code to the native code or wrap it to the web view?
Can i use many things like open gl es with js code?

Or it can be use for building html5 game only?

Using Javascript you can:

  • run in browser (WebGL w/Canvas Fallback)
  • run in a web view wrapper (since it runs on mobile web)
  • if using CocosCreator directly, it should output native packages when publishing for device (ios/android)
  • manually publish as native app by creating a cocos new ... -l js ... project and adding your javascript files as resources

With C++ you get every platform except the web (out-of-box, but you could get it to compile w/emscripten yourself).

1 Like

@stevetranby Any big differences in performance between c++ and js?

You will see some performance differences, depending on the optimization of your code(creating many javascript objects can be very costly) since js code is executed by a virtual machine(Firefox’s SpiderMonkey VM in this case) and doesn’t get somehow compiled like the C++ code, so there will always be a runtime overhead when using a scripting interpreter.

So if i will publish via cocos creator (I am using Type Script for coding), will it publish my game as a native build & code or will it be using a webview to run inside a native adapter?

https://docs.cocos2d-x.org/creator/manual/en/publish/?h=publish

Okay, i have gone through the manual but i still feel that the output native uses webview inside it, is it true?