So, can we use javascript and will make a native build, no a webview but a app with a c++ core engine (cocos2d-x)? because we have tried but we donât found how. when we set android in build form the build will be in native?
Hi smellypotato, what do you mean with âmake sure your code works in c++â? Inside CocosCreator, can we use c++? Or the javascript scripts that we wrote, it must follow some policies?
So, (to understand well )) when we export in Xcode or Android Studio, the project has a core cocos2d-x c++, and all our javascript is converted with jsb? Sorry for all these questions, but we are new in cocos creator and we would to understand it works it inside
@C_Stefano. I was also curious about the native thing. Most JS game engines wrapp it into a webView. But with CC v2.11 you are able to compile it to native. In a Windows OS you just need CC, android-NDK_r16b, android-SDK_28, Python too, not sure which version & Gradle. No need for a âAndroid Studioâ (hate it). You can compile it via CC Build-window This setup worked for me ! The APK was really small ~ 5mb, and it is performant on low-end devices (i used a very old 1x core android 4.0 phone). I was really surprised.
@slackmoehrle, Its true that nowadays you don´t need to take care about performance on smartphones. BUT, i would say it is really good, if you write elegant code, so you can ONLY test it on old low-end devices. Otherwise you have bloated code and it runs fine on high-end phones and you even don´t recognize that you wrote bad code. Also if it runs fine on high-end, the downside of a bad code is, it consume more energy f.e. This is also one reason why i like game engines that runs super smooth on old low-end devices.
@sledgehammer what I meant was the OP doesnât have to worry about our performance on low-end devices. NOT that the OP can write crappy code and not worry about performance from it. Bad design will tank any hardware.
Hi @sledgehammer thanks for answer. So, inside CC(cocoscreator) we set NDK and SDK-28 and âCCâ will compile out project for native mode? I have understood right? (so not a web view). Because our entry-level will be 4.0⌠or minor.
Thanks!
@slackmoehrle , k got it. @C_Stefano. Yes, this is correct. Inside CC, under the âBuild-Settingsâ you can first âbuildâ second âcompileâ. Before you do this, you need to specifiy the path of NDK & SDK inside the CC-âsettingsâ. I would say it is also important to set / to check your whole âevironmentâ-pathes (for Gradle, python, etc) in your OS, so any software can find it. Thats it ⌠And yes, it worked out of the box on my Android 4.00 (really the old one). So no need to change anything in the âgradle.propertiesâ file. But if you wish, you can edit it and specify more lower entry-levels, i guess. I didn´t test this. I am happy i can catch all Android 4.0 + devices.
@C_Stefano
Something about performance:
What i found out, is that 3D Sprites (unlit mat) are much much smoother when moving / rotating as the usual sprites you would use ! And i used the same code in both versions. Can´t tell you why 3D is smoother in movements, but its the case. Maybe you can try it out.