Cocos2d-x vs Cocos2d-js for mobile games

Hi all,

I’m new to cocos2d, i’m curious to know what is the main difference between cocos2d-x and cocos2d-js?

Is cocos2d-js support for windows phone 8?

And also, Is cocos2d-x version 3 support for windows phone 8?

We are planning to create a mobile games for IOS, Android, WindowsPhone and Web.

Thank You.

choose cocos2d-js if web is your main target.

Pros
Super fast iteration when developing.
Able to update the game without app store submission

Cons
Hard to debug complex projects
Hard to add 3rd party SDKs because of the js binding process.
Even less documentation than -x :frowning:

i would recommend for now stay away from WEB if you not have enough time to investigate and handle lots of issues :wink:

I chose cocos2d-js simply because my background is in web technologies. I am a web developer (JavaScript) so it was the best choice for me to stick with JS.

@efares
And how it goes? Can you show your released game with Cocos2d-x JS? :slight_smile:

So far it’s going well. I only started a few weeks ago so I’m kind of new to cocos2d as well.

I’m basically following this really useful game tutorial to learn the basic game development from beginning to having a final game: http://cocos2d-x.org/docs/tutorial/framework/html5/en

I’m about half way through it, taking notes as I go along, adding personal comments to my code.

Then I’m afraid:) that you will stuck at some point later :smile:

What about Text labels, have you noticed that all text is blurry?

Why do you think I will get stuck later? Are you saying the tutorial is bad or cocos2d-JS is bad?
And I don’t use Text labels, I make all my assets on Photoshop then add them as sprites, images or buttons.

I would say this framework is not ready for serious WEB development.

@energyy

The blur text labels is caused by different screen resolution and your design app resolution.

There is reported issue on GitHub but still in open status.

Cocos2d-JS do have problem on Web as it might behave differently with native.

But it is still a good option for cross platform as we only need code once and may be with some modification, our app can run on any platforms.

Although, it depend on what kind of project you developing as different platforms would have different capability.

I do faced a lot problems when trying to make my projects run on Web but at least i have the chance to make it work when i solved the problems.

It is good to see our own app can run on any platforms.

@Zinitter Glad to hear it :smile: that someone manages to pass all issues with JS

Have you launched some project to production on web? Would be interesting to see it capabilities and what to expect.

BTW had you issue with positioning objects, that they appear on different positions in Chrome, Firefox, Safari…?

@energyy

I not really manage to pass all issues as the blur text label is still blur when view from mobile device browser.
But in PC browser it looks nice.

I do have a project but still need some modification to make it function properly after compiled in --advanced mode. But i’m busy with other projects so release of that project is delay.

About positioning, i think i don’t have issue on that because i fixed the design resolution and position them with a relative size scaling factor.

i’m using this setting

cc.view.setDesignResolutionSize(2048, 1920, cc.ResolutionPolicy.FIXED_HEIGHT);

If you use different cc.ResolutionPolicy, it will have different positioning effect.

Then in web, you have to modify the canvas width and height to your desired dimension in “index.html”
I put the gameCanvas in a div to constrain it not expand beyond the designed size.
You may try study about html coding if you interesting on it.

<div style="width:650px; margin: 0 auto; ">
<canvas id="gameCanvas" width="650" height="900px"></canvas>
</div>

@Zinitter Thanks for tips, will try! Can we connect in skype ?

@energyy

I don’t use Skype.

If you have problems, i suggest you post in forum as there are many users in forum who are much pro than me to help.

1 Like

So, it means if i want to make game for smartphones, i have to come to cocos2d x instead of using cocos2d-js?

What do you mean it able to update game without app store submission?
Building game with javascript so how will i port it to app version?
And hows about the performance, javascript with v8 engine performs not good as native language.
I’ve tested many HTML5 games, but it makes my phone gets overheating.

Cocos2d-js has hot update feature to enable you update your game code from web
Regarding performance, yes js is not as good, but there are tricks you can do to optimize the performance.