Hi, I’m looking to to port my ios cocos2d-iphone game Online Sniper League to Android and I’m considering using cocos2d-x. I learned objective-c on the fly over the past couple years. I’m not a big C or C*+ guy but I can pick up different languages fairly well. I have some questions though.
My app is based on cocos2d-iphone 0.99.5. Does cocos2d-x support most/everything in there for android too? Is the performance comparable? I would only be supporting devices with 3GS or higher type of processors going forward on both platforms.
How much effort is it to port objective-c to c*+? My game is basically many layers, many subclasses sprites, and many timers. It has simple animations and some particles.
Is this platform mature enough right now for me to jump in or will there be growing pains?
Thanks for your help.
About 98 features are ported. I cannot say 100 because the thread related APIs haven’t been wrapped, async operations are not supported yet, but you can do it by yourself. Please run and check the cocos2d-x/tests, it inclues all features.
Here’s the published game list in http://www.cocos2d-x.org/projects/cocos2d-x/apps, including many games from big companies.
Porting objc to c++ is an easy work, the average speed is about 500\~800 lines per man-day, while the guys from “Ah Up” said they ported 3000 lines in just 2 day.
The pain is from android ndk debugging. I suggest you to use win32 port first, debug in VisualStudio, and build to android at the last. It will make porting job easier.
Thank you for the information - very helpful. I’m not really using my own threads - everything is handled by the engine. So, compatibility sounds great - nice work!
My app is over 21k lines of code though. I wonder if any developers on here would take on the task or help me. I can pay.
I managed to port my game, Smart Target (Rock Sliders Lite), to an Android testable working version with only 2 days worth of debugging (didn’t have to rewrite any actual code), but all my code is already in C**. I made it work for Win32 first, then used all the C** code in the iOS project and it worked fine. Then finally, I tried testing the C++ code on the Android project and after some debugging to isolate a silly programming error (don’t put floats in place of a GLUByte when doing a setOpacity(GLUBtye somevalue)). The code compiled and worked fine on the Android project without any re-writing of actual code (C++ that is). Haven’t submitted the game yet though, but planning to once I finish working on the iPad version.
Things I came across that may help:
- I used cocos2d-0.99.5-x-0.8.5 to better support the Android 3.0 OS.
- I used cocos2d-0.99.5-x-0.8.3 for the iOS project as there seemed to be something wrong with the 0.8.5 one where I couldn’t input anything for the Summary and Info page… still figuring that one out.
- The Android simulator is super duper slow… like 10-20fps for box2d testing… so I grabbed an actual dual-core Android 3.0 device to test on (Acer Iconia Tab)
- Android 2.2 devices are super slow for box2d testing… I think it’s due to a lack of OpenGLES support?, but correct me if I’m wrong… Maybe it’s just because the Android 2.2 device that I was testing on wasn’t very powerful? I was testing on an Viewsonic Viewpad 7.
- Be aware of the different screen resolution size of the Android devices so you can plan your iOS and Android code sharing and campatibility accordingly. I based every CCPoint position mostly on winsize.height/2.0f.
- I agree with Walzer’s suggestion to port to win32 first, debug and run in Visual Studio, and then test on the Android device… cuz compiling and running on Android eclipse takes at least 20-30 seconds per compile and run… whereas Visual Studio can compile and run (same small project) within 10 seconds. Same goes for iOS.
Hope that helps =]
Thanks for RosePear’s detailed explanation.
And can you describe more at “0.8.5 where I couldn’t input anything for the Summary and Info page”? What do you mean by “Sumrry” and “Info page”? I would try to fix it in the next version
Steps to reproduce:
Using: XCode 4.0.2, and cocos2d-0.99.5-x-0.8.5.zip
- Open test.xcodeproj
- Click on Test in Project Navigator. Project and Targets show in the main window
- Click on test.ios under Targets. Info, Build Settings, Build Rules shows in the main window
- Click on Info. Nothing will be displayed.
- See attached screenshot.
This does not occur in cocos2d-0.99.5-x-0.8.3 test.ios project. 0.8.3 xcode project target is able to show both Summary and Info display stuff like setting the icons and changing the package name, etc. I don’t know if it’s just my XCode version, but the whole system’s pretty new and I never changed any settings so everything’s pretty much default so I don’t know what’s going on. I haven’t had time to figure out if it’s something to do with a corrupt Info.plist or something similar.
Hope that helps =] Let me know if you figure out what’s wrong or if you have more questions. Thanks!
I’d be interested in helping with your iphone~~>cocox2d-x port. I recently finished such a port, of the iPhone game Chirp Chirp:
https://market.android.com/details?id=com.eyessoft.chirpchirpThis was a game originally written in objective C and using cocos2d-iphone, and was release by some friends of mine about a year ago. It’s a fairly simple game, about 8000 lines of code, and took about 2 weeks for the initial port, and then another 2 weeks of bug fixing .
I’ve also been working in the Computer Games industry for 3 years, first at Pivotal Games and more recently at an indy studio called Zeroscale, working on Playstation and PC games. Both have unfortunately closed down now, hence my branching out onto Android.
Let me know if you’re interested~~ please contact me at email@example.com .
RosePear Studio Thanks, bug #604 is created, it will be fix in the next versionJames Dailey If you’re looking for outsourcing the porting work, Isaac Ashdown is the right man
You guys are great! This is a very helpful forum - much like the iphone counterpart. I sent an email to Isaac. I assume googlemail is gmail.
@Walzer - thanks for the support!
@RosePear Studio, #604 is fixed today.
For 0.8.5 version, you can simply fix the bug by these steps:
# open test.xcodeproject in xcode4, direct to TARGETS~~>test.ios~~>Build Settings~~>Base SDK~~>Debug
# change the sdk setting from “iphonesimulator4.1” to “Lastest iOS”
# do the same to cocos2d, box2d, chipmunk, CocosDenshion in TARGETS
Then you can see “Summary”, “Info” correctly in TARGETS->test.ios
This bug waste me 4 hours to compre different project.pbxproj files, re-create Tests project in both xcode3 & xcode4 many times. And at last I fortunately click the SDK settings and find all things well. Thanks God!