What are the advantages of using cocos2d-x 3.0 over cocos2d-x 2.x?
Asked Answered
A

4

8

Cocos2d-x 3.0 alpha was released for some time now. What was improved over cocos2dx-2?

The features list is quite important, but in terms of performance are there new limitations/improvements?

Have you noticed real improvements in performance, development patterns, APIs and support?

Affecting answered 20/12, 2013 at 1:42 Comment(1)
Probably you should read release notes on official site. They have mentioned everything there.Inroad
C
11

I've been using it recently and from what I've noticed the main differences are that everything is namespaced now, so you don't have to deal with the prefixed names that came from the objective c patterns, so cocos2d::Point instead of CCPoint (especially for enums, (Texture2D::PixelFormat::RGBA8888 instead of kCCTexture2DPixelFormat_RGBA8888)).

Also some of the event stuff now has support for c++11 lambdas.

A more complete list of the changes can be found here: http://www.cocos2d-x.org/wiki/Release_Notes_for_Cocos2d-x_v300

but for the most part of using it myself, it's just made to feel more like C++, instead of like objective-c.

Calliope answered 20/12, 2013 at 2:44 Comment(0)
S
4

I have switched and am finding it pretty stable. The main advantages so far ...

  • Real buttons, instead of menus
  • Real-time spritesheets
  • SpriteBatchNodes are no longer recommended and I did see a drop in draw calls where I not optimized
  • less objective C patterns.
  • more modern. namespaced instead of 'CC'. C++11.
  • more platforms supported

Main disadvantages for me:

  • EventListener pattern. I can't figure out how to get touch input to affect any objects other than the Node that triggered the event.
  • We use a lot of text-only buttons for debugging and they are hard to lay out :)
  • Lack of documentation and example code. For example, I could not find any documentation of how to use the Layout class anywhere.

It is a lot of work porting, but for us we had to decided to risk it since we would end up maintaining an out-of-date code base. It took about 5 person-days to port our game over. The game is now stable and we did not run into a single bug in cocos.

Stucco answered 15/5, 2014 at 9:19 Comment(1)
I was wrong about the EventListener pattern and just didn't understand lambda expressions. The pattern is great.Stucco
J
3

I think its C++11

  1. auto
  2. lambda

And it has no unnecessary use of prefix CC

Jennee answered 10/5, 2014 at 17:28 Comment(0)
L
2

One of the changes that happened between Cocos2d-x 2.1.5 and 2.2 was the removal of templates for projects in XCode (I do not know if project templates existed in VS, etc).

The new build system creates projects under the Cocos2d-x installation (at least on Mac) and that is where the project files appear to reference them. This makes it very difficult to move the project without hand tweaking. It also makes configuration management more painful, depending on how you set up your system (e.g. a root/tree like svn or a "drop it anywhere" like git).

Also, the Cocos2d-x library is built as that, a library. In previous incarnations, it was placed directly into the project. On one hand, if you don't alter the root library code, this makes good sense. On the other hand, if you occasionally tweak things for a specific project, you have altered all your projects that depend on it. Yin/Yang.

I'm still very positive on Cocos2d-x. I have not upgraded to 3.0 or 2.2 yet. When it matures a little more, I will switch over, regardless the changes. For what I need, I'm pretty sure it will still get the job done (well).

Likelihood answered 21/12, 2013 at 0:41 Comment(3)
An update comment from just trying to get started with v3 on Mac - the "cocos new" command line works very smoothly generating projects in the directory you specify.Convolvulaceous
@AndyDent I recently upgraded a project from 3.0 to 3.2 and I am now actively working with 3.2. It seems "OK" so far. Still haven't figured out all the nuances, but I was able to get this up and running: youtube.com/watch?v=HWiiExd16Cs.Likelihood
Thanks for the feedback. I'm stuck with XCode 4.6 on holiday (old MBP) so am having to stay in v2.2 as v3 was not building but based on your feedback will try 3.2 (I had downloaded 3.3rc0).Convolvulaceous

© 2022 - 2024 — McMap. All rights reserved.