New to Cocos, please, need help

Hi everyone,

I’m new to Cocos (came from Unity) and confused with its support of JS and C++. Not long ago the beta version of “all-in-one” Cocos was released. I mainly want to target android, 2D games with physics. So my questions are:

  • Cocos2D-X, JS or beta of X-JS? If I choose Cocos2D-JS, will I be able to make C++ ptojects with it? Else if I download Cocos2D-X, can I test my games in browser?

  • Is it necessary to have Visual Studio installed to test apps on Windows? Compiler says: Can't find correct Visual Studio's path in the regedit.

  • How to properely set up the IDEA environment (Cocos IDE v2.0)? There’s no articles at all. If I won’t set up it properely, I’d rather go to Eclipse.

Thank you very much for any help!

P.S. Sorry for my English.

Welcome!

You are in good hands :smile:

No. If you want to make c++ games, use -x

no

yes it is necessary. There was someone using mingw but I don’t know how that ever made out. You can use the community edition that is free.

I am not sure, exactly, I don’t use Code IDE. I know that lots of people do. You would use this for JS and Lua apps only. NOT Cocos2d-x apps.

Thanks! And… I guess you’re tired of this kind of questions. What should I use - C++ or JavaScript? As I learned from on this forum, if your game is not so coplex and/or you want to publish it in the Web - use JS. In other cases - C++/Lua. Am I right?

I never get tired of any questions.

yeah, you can say that. Web = js. Anything else, JS, Lua or -X will work depending upon what you are comfortable with.

Hi, for complete information you could read Cocos2d-x Essentials book. As for me, youtube tutorials, information on forums and examples of other Cocos games will be enough, I suppose.

Awesome, thank you!

Hello @slackmoehrle!

Need some help. I can’t still decide which language I should use. JS has pretty simple API, works on web, but, as I read from “Why JS sucks” kind of articles, it may sometimes behave strangely and dumb to errors. And yes, garbage collector.

If JS is so simple and supports html5 to run in browser, why do most people use C++? Do both languages have exactly the same performance, or garbage collector and dullnes of JS have an effect? I know that all stuff related to cocos2d recompiles to C++, but how about the other scripts?

And I read that if some of JS scripts is running slow, better rewrite it in C++. How can I implement .cpp files in JS project? Or should I bind it somehow?

Thanks for reply! Have a nice day!

I honestly can’t tell you what language to use. It is really up to you.

If you want your game to run on the web, use JS.

If your game doesn’t need to run on the web you can use JS, LUA or c++.

All languages differ in performance, syntax, capabilities, etc.

Tell us what your goals are and maybe we can help more.

You can check out our hundreds of videos tutorials on

http://www.sonarlearning.co.uk/topicpage.php?topic=game

I just curious to know why is C++ more popular in cocos than other languages. If JS has all the same features, simpler to develop, plus targets the web - what is the reason to use C++? Is it because all the game logic code runs in JS and may glitch sometimes?

For example, if I want to make a 2D platformer with procedural-generating world (some sort of 2D minecraft), or a strategy (like Cililization), or a space shooter, even not publish it on the web and target only mobile, will JS have a smooth perforamnce? I mean, all the game logic written in JS?

C++ has long been a game development language of choice since before JS. C before that and Assembler even before this. People even wrote games in BASIC. I don’t have a good reason why. This is just what happened.

At the end of the day, I don’t think it is so much about the language as it is about what language you can learn the easiest. You will probably work on your first project, then maybe a second and look back and say “why did I do A this way? How stupid was I”. We have all said this. You learn from each line of code you write in some way.

You mean, language is not so important as developer’s experience? Good, I will keep that in mind. But also I want to know if JS will work fine for me:

I can’t really tell you if JS will work for you. It is capable of writing games, obviously, but I mean, but if you want to write a Minecraft clone in JS, JS isn’t the limitation here. The limitation is the developer knowing how.

Rule: Languages can do whatever the developer makes it do.

Good, I understand. Main is to keep practising and develop yourself as a programer, the language isn’t the key thing. Thank you!

I really feel that it isn’t, true.

From the formal point of view, js and c++ are equivalent in power. Both are turing complete.

From the user perspective they are very different.

You should investigate the root of both languages and see the difference between full typed compiled languages(c++, c#, C, Java, Pascal, Objective C) vs prototypes and scripted languages (LUA , JS, AS and so on).

The thing I like the most of typed and compiled languages is their compilers can do a lot of work for you before the code runs. On the other hand, JS or Lua code is not checked at compile time(since they are not compiled) until the actual code runs. This can be very bad if you don’t use techniques to avoid it (e.g unit tests with full coverage). There are tools to verify correctness of JS and Lua code to detect typos and stuff like that but they perform very basic validations.

In addition, typed languages usually have better auto completion support due to the types precisely.

And the most important one ((IMHO) , these languages C++, C# , Java usually perform much better in computation time and resource consumption (sometimes orders of magnitude).