Comparison FPS between iOS Browser and CocoonJS

Discussion and feedback on Construct 2

Post » Sat Feb 16, 2013 6:57 am

Hi Guys, im working to get decent performance, i couldn't figure out how to improve performance in CocoonJS, please download this .capx, it's simple it has 13 events.

http://dl.dropbox.com/u/76227787/FallingBlocksPerformance.capx

Touch any blocks that you can destroy some blocks in diagonal, they fall blocks and it doesn't use Physics behavior.

I had some weird results.

iOS 6.1 Safari (iPod Touch 4): i get 15-22 FPS as average

CocoonJS 1.3: i get 11-13 FPS as average, i felt like WTF i had no idea why we know CocoonJS can boost up the performance.


If you think this event sheet from .capx isn't correct, i would be appreciated if you explain how to make a workaround.

Thanks!
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sat Feb 16, 2013 7:49 am

Found your problem. I'm not sure how to fix it yet, but it's your falling block code. it's just killing performance by a massive amount.

turning it off bumps fps back up to 62. However you obviously need it. I suggest figuring out a versio of block falling rest state.

On blocks destroyed command.
set all blocks to rest false

if block rest = false, then drop.
upon success of falling, block rest = true

that way your not constantly causing the block checks to fall. i know you have the trigger once, but i don't think it's the appropriate usage.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sat Feb 16, 2013 9:54 am

Ok, what happened. C2 uses a brute force collision check. The block falling check was doing 2500(50x50 blocks) collision checks per tick. And no block managed to reach anykind of rest state


oh, I got an idea. Give each block a Row/Col and a gotoX/Y variables. Upon deletion of block itterate each col(by for each ordered, block.col, descending) where blocks where destroyed. Assign the above blocks new Row and set a gotoY, and set falling = 1.

then block.falling = 1 and block.y < block.gotoY
-set position block.y = whatever
-if block.y > block.gotoy
-- block.y = block.gotoy,
-- block.falling = 0

I'm off too bed, but if I can help work on it tomorrow if you like :)
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sat Feb 16, 2013 3:46 pm

This test is definitely CPU-bound because of the 2500 collision checks per tick. CocoonJS only boosts renderer performance, not javascript performance, so you shouldn't expect to see better CocoonJS performance for this type of thing. You should definitely not to intensive collision checks like that every tick; try to run the checks only when the position of the blocks has changed.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sat Feb 16, 2013 11:25 pm

ok, it's not done, but I think it's on the right track now :)

https://dl.dropbox.com/u/14087254/FallingBlocksPerformance.capx

What you need to finish up is to work on the "on Destroyed"
Wher you need to itterate through all the current blocks above the missing ones. Set new gotoY and falling = 1. and the same for the new blocks.

But the first set works 100% and maintains performance :) so the collision check problem is solved. Mainly because I removed it.jayderyu2013-02-16 23:26:31
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sun Feb 17, 2013 1:25 am

Ok, it would be collision check problem can affect the performance.

If i couldn't figure out how to make a workaround to replace collision check to something like positions, it's WORST NIGHTMARE :S


@jayderyu honestly, you only removed collision but it doesn't solve to make it look like real falling blocks, i was thinking if could use compare 2 variables between another block position Y and block height, so i don't believe i will get resolved :S
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sun Feb 17, 2013 4:00 am

Anyone could help me?

I'm desperate :S
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sun Feb 17, 2013 6:48 am

I posted a reward if you are interesed to help me.

http://www.scirra.com/forum/topic63653_post390400.html#390400
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638


Return to Construct 2 General

Who is online

Users browsing this forum: Mirlas and 11 guests