Some basic questions for learning plan


#1

Trying to see how I can start my learning and plan ahead, considerations such as language to use, convenience and learning curve.

Using cocos2d-x, it means I have to write code for each platform.
I installed Android Studio, I would have to write code in C++, and I build the project directly in android studio.
For iOS, I install Xcode, write code in Objective-c and build from Xcode and build in Xcode.
For html5, what is the recommended IDE? How to build for html5 with cocos2d-x?

Using Cocos Creator, I write code in Javascript and I can build for both Android, iOS and html5.

Only Cocos Creator allow me to write once and apply to multi-platforms, is this correct?
Does the mean using Cocos Creator would be best because I can apply to multi platforms easily. Any downside to using Cocos Creator than learning to use cocos2d-x by itself?

Shown in the image all 5 results from the page takes me to a page with 404. Will this be fixed? I’m only searching for answers, if those 404 are the answers please help fix them.


#2

yes many links are broken, maybe we can ask @slackmoehrle for this issue.


#3

cocos2d-x only requires you to write code once and have it work on each platform, provided none of that code is platform-specific. For example, if you wanted to write code for using a device’s camera, you would have to write code for each platform separately because each will have its own method of accessing the camera. So when I write code for my app, I use XCode, and when I need to create the Android version, if I didn’t write any platform-specific code, I can just compile the Android version without needing to write any other code. And if you need to write platform-specific code for your CocosCreator project, then you would need to do so in pretty much the same way as cocos2d-x, I imagine.

I think cocos provides a script for building your app for each platform, so if that’s the case then you won’t need a separate IDE for each platform; you just need to write your code once in one IDE and then use the script to compile for each platform. I have never done this, so I’m not entirely sure. You will need certain tools installed for each platform for this to work though. This is how CocosCreator probably does it; it just already includes the precompiled version of cocos2d-x that will load in your JavaScript and scenes.

For JavaScript apps, you have a compiled version of cocos2d-x that will load your JavaScript files and run them. Once you have compiled cocos2d-x once for each platform, you shouldn’t have to compile it again, as long as you don’t need to write platform-specific code or C++. You do not need to recompile when you have changed you JavaScript files. And I’m not sure if there is a build process for HTML5. I think you just create a new cocos project and everything is ready to run.


#4

The wiki is gone. The content there is very old. There is a re-write rule:

location /wiki {
rewrite ^/wiki$ http://cocos2d-x.org/docs permanent;
}


#5

Is there a official guide or a book that shows the steps involved in doing the “write once” and build for multi platform tutorial?

Which IDE to use? which script or what is the thing that links the builds to the scripts?

In the official documentation, creating a scene goes straight to writing this line of code, where and what are you using the write this line of code? Where is the javascript version? Or there is no javascript version?

In this part of the tutorial says I should use “Cocos command-line tool”, that hyperlink takes me to a 404 page(http://cocos2d-x.org/docs/cocos2d-x/en/editors_and_tools/cocosCLTool) Where is the correct page for this?


#6

the link is missing the .html extension: http://cocos2d-x.org/docs/cocos2d-x/en/editors_and_tools/cocosCLTool.html

it is up to you. an IDE or text editor is fine. If you use XCode or Android Studio you can compile from directly within. You can always use the cocos compile .. command from a terminal

use a text editor or whatever you wish. For javascript we recommend you use Cocos Creator. Here is the JavaScript API Reference: v3.x JavaScript

I started a PR to correct links: https://github.com/cocos2d/cocos2d-x-docs/pull/78


Documentation on CLI android compilation is wrong
#7

I think the Cocos Creator is not open source but it does seem to give lots of pay worthy features, but I want to learn from the ground up on Cocos2dx engine.

I’m still looking for some recently written recommended reading to do the “write once” build for multi-platforms. Any recommendations? There is quite a bit of old tutorials says its using something called Cococ2d-js but when I found that repository says its merged with current engine, so its no longer used. So I’m thinking there has got to be some Cocos2d-x new javascript tutorials that doesn’t use cocos creator.

My current understanding of the workflow to use the Cocos2d-x engine is as follows:

After installation of cocos2dx engine, write the code, use command line tool to compile a project.
From the command line tools tutorial, I see it can compile for iOS, Android, Mac and Win and web.

Are there more examples of the command line tool? I can’t find an example for web, or web mobile?
Where are the javascript examples ?
What would be the equivalent of creating a scene for javascript?
Taken from the documentation for C ++ auto myScene = Scene::Create();


#8

Yes, around cocos2d-x 3.7 c++, js, lua were all merged into a single download.

You should look at our docs, this is well discussed.

JS API Ref: http://www.cocos2d-x.org/docs/api-ref/js/v3x/


Documentation on CLI android compilation is wrong