impossible in iphone

Discussion and feedback on Construct 2

Post » Sun Dec 08, 2013 2:26 pm

This garbage game I made 5 sprites works for me 30 fps and every time I throw a bomb slows down and gets me up to 5 fps... tested in this iphone 4 to how much you will you?

https://www.dropbox.com/s/cflspxgo0hsesjl/bb.capx
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Sun Dec 08, 2013 2:44 pm

Right now, you have the screen being filled by the gpu about 2.5 to 3 times on each frame : on the layer tab, you have to make the background transparent in order for the gpu to "ignore" it.
Next, your collision objects are very complex and being checked all the time. This is very heavy on performance, regardless of the engine you are using.
Instead, you may want to :
1- have your sprites not collide and build invisible rectangles for collisions
2- only check for collisions when your character is overlapping or is close to a collider.

Try to launch your game with the "debug layout" button to see how many times collisions are checked per frame. When you launch a bomb, the collision checks are multiplied, that's the reason why you get such low performances.


Good luck,
Nathan
B
79
S
22
G
4
Posts: 311
Reputation: 12,774

Post » Sun Dec 08, 2013 6:48 pm

Well my iPod touch 4g which isn't as good as your phone. but seems to be along the same family line.

I turned on WebGL
You used a TileBackground, but those should always be power of 2(1,2,8,16,32,64,128,256,512,1023,2048) and not any other. So I changed that to 256. However since your background is only of 1 colour. I made the layout BG colour to that of the image colour. I turned off clear background. Also I'm not 100% sure on this. but I don't believe CocoonJS supports TiledBackground very well and using that will cause slow down.


You On Touch and Every 1 second is improper. and I fixed that up too.

Prior the game ran at 30fps.
Before changes and WebGL turned on ran at 60fps

After changes
For me the game runs at 60fps.

The explosion animation kills performance. And here is why.
There are a total of 6 frames in your animation. However your forcing an animation rate of 15/19(bullet1/2) was too high. What is happening is that C2 is trying to cycle through the animations faster than you have animations. So this is causing your animation to get into very large loops which is causing a massive performance hit. This really shouldn't happen at all. But it is being wierd. For some reason a speed rate higher than your frames seems to create a minor slow down. wierd.

I toned this down to just 3 fps for a test and the speed ran fine. Of course you want the explosion to be more than 3fps. So do was you need. But be careful not make it to high.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Sun Dec 08, 2013 6:54 pm

@Valerien
The collision is not the problem. The app only has 3 objects to collide with. Though he should use bounding box. It's still not the problem.

Also it's not creating multiple bombs. The Event is OnTouchStart. So even with the 1.0 second every time there is no effect.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Sun Dec 08, 2013 8:46 pm

This is weird. Animating the explosion slower produces better performance. But that shouldn't happen at all. I wonder if there it this has to do with the explosion images. I take a look at them at let you know if I find what is peculiar.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Mon Dec 09, 2013 12:12 am

eh. I can't seem to figure out 100% why there is a performance drop on the explosion. But here is the capx running most of the time at 55+fps

https://drive.google.com/file/d/0B0V2EvCXNzYUQWRuckViYTJGLU0/edit?usp=sharing

maybe some one else would understand what is happening. I know when the Animatino speed was closer to 15+ the FPS would drop to 30 and even 15. But now only 35-45. But it's still odd. Good luck.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Mon Dec 09, 2013 11:39 am

I did not know it was so complicated ... You see it in your explorer and it works so well and then the iphone goes bad.

It's funny because trying to do 4 games of distinct style and I all go horribly wrong, just have to learn how to render the games.

He had an almost entire game that took me months of work and at the end I had to throw that was horrible, like if I put it here could you help me
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Wed Dec 11, 2013 2:33 pm

are you sure you have 55 fps? in my debug mode I get 33 fps. what else I can change to get more fps
B
13
S
2
Posts: 297
Reputation: 1,717

Post » Wed Dec 11, 2013 4:37 pm

yep. CocoonJS reports 55+ FPS. I just want to be clear I never test through the browser on a mobile device EVER.

I just don't believe in using a browser on a mobile to play games. The graphical bar over head can cause problems. You can't lock orientation. it's just for me not a good testing devise.

Also my test device is an iPodTouch 4g. So it's not that new or as good as an iPhone4.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests