I am making a simple ball game using standard sdk and it runs ok on my iPhone 4. Tested it on an iPhone 3G and it is very sluggish. The game has one background graphic that is 137kb and 12 balls that are 8kb each. My code moves one ball then checks for collisions with all other balls. I have read optimising guide and used all locals.
I am wondering if I can improve performance or if corona not able to make this run on iPhone 3G.
Any tips for further optimising or ways to test where the bottlenecks are much appreciated.
Thanks
Paul [import]uid: 7863 topic_id: 2285 reply_id: 302285[/import]
can you provide the source? 12 balls and a background isn’t much and something like this would run on my Ipod Touch 2nd Gen smoothly. I know that the 3G has a little less power but also should run fine I think.
Mike, I did originally email it to an email address on the whois records for one of your domains but after your post I emailed it to the email address you included in the post. Did you get it?
Thanks
Paul [import]uid: 7863 topic_id: 2285 reply_id: 6950[/import]
I believe the main culprit was me leaving print statements in my code so if this is true it is definitely worth noting this on your optimisation page as the performance improved from totally unplayable to completely fine on iPhone 3G
Michael may want to confirm this and elaborate more. [import]uid: 7863 topic_id: 2285 reply_id: 6986[/import]
Thanks guys for the flowers. Like Paul said, his print statements for debugging info were bringing the framerate of the device really down. Espercially as he did it twice at every frame.
Another thing, but maybe not such a big improvement was changing the calls to math functions into a local function call. Pauls code does some quite intensive math there and I believe that is always a point of optimization. then there was a small thing where I changed some multiplications to be done once before a formular and then used the result later to be subtracted. In his version he did the same multiplication several times in a frame.
Generally the physics involved in the code could be redone with the game edition and might run even smoother then.
I am really curious about this game.
Cheers
Michael [import]uid: 5712 topic_id: 2285 reply_id: 6995[/import]
The development environment I use to make my living with (until I get going on Corona, heheheh) has something like this in the language:
#if DebugBuild then
MsgBox "You're in the IDE"
#endif
When the project is actually built, nothing inside the #'s is included, so debug stuff doesn’t go into the compiled app. That means you don’t have to comment out all your debug statements before doing a build.
If there’s nothing like that in Corona now, maybe that would be a handy addition.
Jay (J. A. Whye)
[import]uid: 9440 topic_id: 2285 reply_id: 7004[/import]
Yes, that is what I showed to Paul. You can determine if you are in the simulator (check the platform) and then react on this. [import]uid: 5712 topic_id: 2285 reply_id: 7017[/import]