Starting my way using Cocos2dx. Android and iOS sharing the same code. Box2d, performances and other ideas.

Starting my way using Cocos2dx. Android and iOS sharing the same code. Box2d, performances and other ideas.
0.0 0


Hello world!

This is the first time I post here (well, my own thread anyways). I will start by thanking the crew for the efforts on converting the wonderful cocos2d library to c*+ so we can port it to android without too much suffering. What you guys are doing for free cannot measure how is helping others. I hope good karma gets in your way! And if you ever come to Brazil i will sure buy you a beer! Funny enough riq is Brazilian, so im more then proud of being a part of this community! :slight_smile:
I hope i could use this thread to ask any questions i might run into. My background is as this: Im a developer used to develop in objective-c so i guess i can program in any language, as any good developer). Even though i didnt touch c*+ in a looooong time, im not scared and quite happy to get into another language after a good run in objective-c. But after seeing some tutorials, i guess c*+ is really objective-c ugly ass brother, and i will sure miss objective-c. But enough rambling. Im almost done with my game using cocos2d and it is a quite big game for a quite big company, it is going to be a free game for a government agency, it is all done in pure objective-c and now the client decided he wants to release on Android as well and gave me a few more months to port it to android. I have 3 more months and believe is a good time frame to convert everything from cocos2d to cocos2dx . So i have a couple of questions before i find myself in a road without return and I hope you guys could enlighten me on some doubts. I have just a few to start of so here it go:

  1. My game is quite heavy on the graphics side . The running game has at least 3 spritesheets with 2048x2048 pixels and not to mention sounds and some other small sprites that cant make it to the spritesheet, iOS suffered a bunch and i had to convert them all to rgb 4444 using texture packer, witch gave me a a good FPS and made the game playable, even though on iphone 3gs it still suffers quite a bit and lags from time to time.
    This is my main first question for now: I really wanted to use a hybrid project , so when updates come, i just update one code base and release to all platforms. But im too afraid that this might affect iOS greatly. Do you guys have any experience on this ? Does cocos2d in obj-c runs faster then his c*+ brother in iOS ? Should i do tests to find out ? Any experience on this subject ? Is android c++ slower then obj-c on iOS ? I have optimized my code a great deal, and my game is still heavy and graphics, im so afraid the android version will run sooo slow! Any thoughts ? Experiences ? This is my main doubt. Afraid that i will suffer a lot from optimizations and slowness. I know that the best way to find out is just testing, and i will, just hope some advices and tips come first before i pull my hair out!

I have a bunch of other questions, but i rather study cocos2dx more then fill you guys with a bunch of questions already answered.

I have a feeling this might be a stupid threat, but i guess it wont hurt to ask. Hope you guys can enlighten me a bit more, and im so sorry about my english, i tried my best! :slight_smile:



1.1 If you regard yourself as a problem solver, engineer, developer familiar with any language, well, perhaps you’re a geek.
1.2 Believe me, c*+ is more ugly with objc.
2.1 c*+ is as fast as objc on iOS. Your problem probably is: if your game is “quite heavy on the graphics side”, then you may have to cut some effects, reduce the complexity to fit some middle-end android devices. I mean the problem is on the performance difference between ios & android devices, not on the programming language or framework. By my experience, we only suit FishingJoy on HTC G7 and higher hardware.
2.2 About optimization, CCSpriteBatchNode and BackgroundBigSprite->setBlendFunc( (ccBlendFunc){GL_ONE, GL_ZERO} ) is very efficient.

3.1 Welcome to cocos2d-x forum! Please feel free to ask any questions. :slight_smile: