i am developing a game in which i have 10-12 sprite moving at a time in one scene can that slow down the simulator? in my game if i click on sprite moving at top i.e. plane from which humans jump down. so if one click continuously 6 or 7 times at time 6 or 7 sprites appear and it slow down. i have not tested on iphone but its slow down's simulator. m using scheduler to move all images. does it affect.
can moving many images at a time slow down the simulator?
(20 posts) (7 voices)-
Posted 2 years ago #
-
i don't think so... can you post some code?
Posted 2 years ago # -
i cant post code its too big. for human bodies i have created different layer file in which created a shapes. and then created instance of that layer and stored them in nsmutable array. and move shapes in layer by using scheduler. so now what u say does it affect? coz when images are less than 6 it works fine
Posted 2 years ago # -
Adding more objects can, of course, slow down your game, although 6 images shouldn't slow down your game that much. We cant really help you like this try to add some more info like :
-Are you on a slow computer ? The simulator is only as strong as the computer you run it on.
-You are talking about body's, I'm guessing you use a physics engine, box2d or chipmunk ?
-Did it run fine on a device ?You say your code is too big too post, try to post some small snippets of the important parts like how you create the images / bodies, how you remove them and the schedule part.
We cant really help you much further without any detailed info.
Posted 2 years ago # -
ok sry for that. computer is not slow. and haven't tested it yet on device. i am using chipmunk physics engine.
nw i have noticed that with sound off application works fine for any no. off images. but wid "sound on" it becomes extremely slow. i am not getting what is the prob. and if i use atlas sprite instead normal sprite will it improve?Posted 2 years ago # -
It is better to use Atlas Sprites instead of sprites performance wise, if you use sprite sheets. Adding sounds of course adds to the programs resources and could lead to memory problems. I would suggest to read the Cocos2D wiki, especially the best practices guide ( http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices ) It has a lot of good tips on how to use Cocos2D optimally. Also if you are using Cocos Denshion I would suggest reading this article http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:faq . Good luck with your game !
Posted 2 years ago # -
Amruta, I think you just answered your question in that the sound is most likely the problem. I had a similar problem with sounds where a short sound would be triggered to play when you hit a sprite, but repeated calls to play multiple short sounds would tank the frame rate. I was using avaudioplayer and it would stutter/cutout and actions were hurting.
I switched to CocosDenshion and this solved my frame rate issues let alone cleaned up the audio issues. Now you can beat away on the sprites and my random selection of short sounds works fine...even playing the next sound before finishing because of rapid touches.
Posted 2 years ago # -
@ xStoryTeller-
hey thank u very much for all links and your suggestions. Those are very helpful.@Tim-
You are right Tim its because of sound only. I have written function to move sprite from top to bottom also play one short sound file in it and started scheduler to call that method. so if i remove function call to play sound it works fine. you have mentioned about CocosDenshion but i don't know how to use it. Can u suggest any links where i can get more information about it.Posted 2 years ago # -
Using CocosDenshion ain't that tricky,
Just take a look in our Wikihttp://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:faq
Posted 2 years ago # -
hey thanks Steve Oldmeadow. that was very helpful
Posted 2 years ago # -
where can i downld this cocosdenshionfiles and can anyone suggest any link where iwill get sample code for cocosdenshion. I read the doc on http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:faq butstill its not clear to me
Posted 2 years ago # -
CocosDenshion is part of cocos2d, there is a directory called CocosDenshion that contains all the files. The demo is called CocosDenshionDemo. I guess those names are quite confusing ;)
Posted 2 years ago # -
ok i just have to add it in proj as we add chipmunk or cocos2d. i have to fix this issue today. m very nervous and confused but i am using 7.2 version of cocos2d and cocosdenshion is not in that. so ifadd from 8.1 version i thnk it will not wrk
Posted 2 years ago # -
CocosDenshion will work with older versions of cocos2d, just add the necessary files to your project.
Posted 2 years ago # -
its not wrking i justa dded that cocosdenshion in my project and imported cocsdenshion.h n its givin err no such file why?? but its there do i have to anytng else
Posted 2 years ago # -
You just add the files and frameworks to a build target and it should work. If I was you I'd seriously consider upgrading to 0.82. It comes with a nice template that has CocosDenshion already set up.
Posted 2 years ago # -
now i have new prob when i load application on device first time game is slow and second time when i start new game without closing application it is faster. now its nothing to do with sound coz having same problem with sound off s well. i think its related to sprite. can anyone help i have no time for research
Posted 2 years ago # -
Perhaps your app is starting to run before all of your game assets have finished loading. You might want to look into asynchronous loading.
Posted 2 years ago # -
can it happen because first time i am running it with runwithscene command and second time with replace scene . so second time it will not have to load all data again????? is it the possibility
Posted 2 years ago # -
Just to give you a littel benchmark: I am able to update over 200+ nodes every tick and mantain >=40 FPS on the older iphone and 60+ on a 3GS, however, if those 200 nodes were alpha blended and overlapping each other it will crawl to <9 FPS
Posted 2 years ago #
Reply
You must log in to post.