开发者_运维知识库
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this questionI 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?
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.
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.
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
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++).
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.
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.
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.
精彩评论