36

I have worked some with Cocos2d for iPhone and find it delightful. I am starting another project, and have stumbled across Cocos2d-x, a C++ port. I'm tempted by the notion of being able to (with consideration) build for multiple platforms at once. I'm equally comfortable with Obj-C and C++, and am not looking for comparisons between the two languages unless it's specifically related to working with Cocos2d.

Has anyone worked with both versions of the engine, and can you comment on specific pros and cons of the two? Is Cocos2d-x "finished"? Reliable?

5
  • 3
    I think this link may be interesting to you, kinda a guide of cocos2d-x: stackoverflow.com/questions/10711047/…
    – Jav_Rock
    Commented May 28, 2012 at 7:23
  • 6
    Since the 2.0 series, Cocos2d-X has become reliable enough to write professional-grade games. I've worked with both Cocos2d and Cocos2d-X. I can honestly say I may never go back to Cocos2d, now that I know what a great feeling it is to be able to compile for just about any platform. Commented Sep 21, 2012 at 15:06
  • 2
    Would consider these comments to be the closest thing to an answer here.
    – j03m
    Commented Jan 8, 2013 at 11:08
  • Apportable looks like it might be a good option once they get all their kinks worked out, in which case cocos2d-iPhone all the way!
    – jjxtra
    Commented Feb 17, 2014 at 22:37
  • This is not my own opinion, but I live and work in Tokyo and what you hear is that if you code in Cocos2D-x, there is a great risk that "as Cocos2dX is very successful in China, there is a big risk that companies in China will copy and paste your code and launch shameless copies just like that". There is certainly some prejudice in that statement, but nonetheless there might be a risk in there. Oh and don't forget about Zynga. ;-) Still having said that, I have never personally used Cocos2d-x (only -iPhone/-Swift/-SpriteBuilder), but chances are I will try Cocos2d-x some time soon.
    – Jonny
    Commented Apr 13, 2015 at 2:15

7 Answers 7

35

The lure of multi-platform builds are a nightmare in disguise. Any web designer will tell you horror stories of trying to juggle IE with Firefox with Chrome with whatever at the same time. You will not suddenly earn more sales because you were able to launch on Android/iOS/etc on day one. More than likely, your attempts to multi-platform will restrict your app in ways that will kill it on all platforms. Your best bet is to start with one platform, finish that, then build for others. Your end product will thank you.

There are no pros/cons to Cocos2d-x unless you like C++ more than Obj-C.

8
  • 6
    Exactly what I would have said. If you've never done cross-platform development before, you shouldn't start considering it until you're already successful on your primary platform. Indie examples are wide-spread, ie World of Goo has only been ported after it was successful. Same with Angry Birds and many other indie games.
    – CodeSmile
    Commented Oct 13, 2011 at 13:23
  • 4
    That doesn't mean you can't create an app in a way that would make it easier to port, should it be necessary / financially justifiable. Commented Dec 13, 2011 at 19:48
  • 4
    If it's your first game, worry about a quality product first. If you're earning money from previously successful ventures, then you can worry about expanding your options. Otherwise, you're wasting your time and what (likely) little money you've got on hand.
    – user481081
    Commented Dec 13, 2011 at 22:57
  • 9
    Where has the OP asked a philosophical question about whether cross-platform or single-platform-first methodologies are better?
    – arithma
    Commented Nov 6, 2012 at 14:33
  • 7
    This answer is outdated. Cocos2d-x has improved immensely. Also, whether or not to target multiple platforms at once really depends on the type of game that you're building. It also depends on the amount of effort / money you or your client wants to put it. This is not the best answer (anymore if ever). Commented Sep 30, 2013 at 6:57
18

I would agree that you should focus on developing for a single platform until you have a good solid product out there. However many a developer that does this after the fact realizes how much effort and additional cost is then needed to completely rewrite the game on a new platform. Would a little upfront thought you can minimize the need for rework and thus minimize your cost once you are ready to port your game. Android is too big of a market share to completely ignore it; in my mind Cocos2d-x is the way to go if you like Cocos2d.

9

I don't know about cocos2d-iphone but I do know about cocos2d-x.

Pros:

  • cocos2d-x uses C++ (well, not really a pro for some but this is a pro for me)
  • You can easily deploy to different platforms, assuming you've set it up correctly (see below)
  • It supports Lua and JavaScript, for an even easier coding

Cons:

  • cocos2d-x has little to no documentation. You would rely on the test projects and the API Reference. Thank god there are people like Nat Weiss who made learning easily available to users. (http://paralaxer.com/cocos2d-x-book/)
  • Setting up your project to work on every platform is a hassle. You'd have to be good at multiple IDEs as well as command line/terminal commands
  • Most of the scripts that come with the library to create new projects are not multi-platform, meaning, you still have to set it up individually for all platforms
  • Integrating third-party SDKs like Facebook, ads, and other stuff takes a lot of time since you'd have to implement them for every platform you are targetting
5

I am developing with cocos2d-x for iphone and it is working just fine for me. Only issue you may find is that the api is always slightly behind the cocos2d for iphone version. However api itself is reliable and a facsimile in most respects to the original.

If you're serious about porting to other platform even though you will try to succeed on a single platform first, cocos2d-x is the way to go, because you will not need to rewrite the gist of your code in some other language later (ie port from c++ to objc or from objc to c++).

3

I have worked with both Cocos2d and Cocos2d-X for iPhone development only (so far). I worked with Cocos2d for about 1.5 years and have moved on to Cocos2d-x in the last six months or so. At first, I was unwilling to move into Cocos2d-x because, in my opinion, it was still maturing. Coco2d 2.0 had come out with a lot of changes and I knew it was well deployed and tested. Coco2d-x seemed like it was still in flux. This has changed and I have decided to use Cocos2d-x for the duration, as long as it continues to be supported.

Both frameworks appear to work as advertised, in general, and give good performance for what I am working on (you can see some examples here).

I am comfortable with working in both the Object-C and C++ world. I don't know if I will ever port my "stuff" to Android, but it is nice to have the option.

However, the BIG deciding factor for me was reusability. I build lots of components and widgets that I reuse in other projects. If I developed for iOS only, Objective-C would be the way to go. But I work mostly in C++ and I don't want to have to recode all the ideas from one language to another every time I want to bring a tested tool out of the tool box.

I think this is going to ring true for any framework you choose to use for your development. If you have the choice, go with the option that will give you the best bang for your buck today, and down the road.

2

I am currently working on cocos2d-x and I am very happy with it. My advise would be to start the project on one Platform (I prefer IOS). And when you have successfully launched on one platform, start on another.

If your game becomes successful, at the end you have to launch on another platform too. So its best to plan ahead.

1
  • I agree that we should plan ahead and consider our strategy of if we want to target multiple platforms at some point. But I disagree that one should wait to test on other likely target platforms if they are serious about eventually publishing to them. The setup to target iOS, Android and Windows Phone is much much easier than I originally thought it would be. And an interesting point is that some games I have published are successful on Android, but not on iOS, or vise-versa. The more players you can get your game in front of the better!
    – Jim Range
    Commented Oct 27, 2015 at 20:21
0

I would stick with Cocos2D-iphone. Focus on the product from the bigger community with a lot more resources. When you are ready to port, then use apportable to compile your app for android when it's done.

Not the answer you're looking for? Browse other questions tagged or ask your own question.