more indepth optimization help needed PLZ

Get help using Construct 2

Post » Sat Nov 24, 2012 4:23 am

I'm having problems getting my game to run smoothly on android with Cocoonjs. I think it has something to do with collisions. My intro/Cinematic layout has 5 collisions total and it runs at 48 FPS, the most basic layout in my game(layout1) has approx 60 collision objects atm and only gets 5-8 fps.

collisions for enemies and pickups are all set to

IS on Screen
System-Every -- seconds
       Playerbox on collision with ...


What I'm trying to do is limit the amount of collision checks. So hopefully I'm making enough sense to ask a few questions.

1. Am I actually limiting checks with the method mentioned above? If not what am I doing wrong?

2 Does the ground tiles need to limit the collision checks as well?

3 if I did the above properly, what is the collision objects limit per layout for the average tablet PC, on average/rough estimate even?


Really I have so many questions and I'm getting no place atm , so any help would be greatly appreciated.

       
B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Post » Sat Nov 24, 2012 7:26 am

Are there events where you expect the playerbox to be colliding off screen?
B
20
S
4
G
2
Posts: 124
Reputation: 2,482

Post » Sat Nov 24, 2012 12:34 pm

Thanks for the reply Isometric,
there are collision events all the way through the layout. they are spread out. the layout is 6144 by 1024. it's layout setup is something like mario bros.
I have "bad guys" on collision with invisible "edgemarker" sprites to turn back and fourth. these are all the way through the level.

Hope this answers your question.

Trailer is posted here if you would like to get a better understanding of what i have so far.http://www.scirra.com/forum/topic59113.html
B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Post » Sat Nov 24, 2012 1:14 pm

you could do something like:

[code]Global constant number ACTIVATION_DISTANCE = 600

+Every Tick
-> badGuy: set activated to false

+badGuy: X > (scrollX - ACTIVATION_DISTANCE)
+badGuy: X < (scrollX + ACTIVATION_DISTANCE)
-> badGuy: set activated to true

+badGuy: Is Activated
-> move (badGuy.speed * dt) at Angle (badGuy.direction)
+badGuy: is overlapping edgeMarker
+trigger once
    -> badGuy: set direction to (180 - badGuy.direction)[/code]

badGuy.direction should toggle from 0 and 180 each time badGuy overlaps an edgeMarker
this way it should easily move left and right between two edgeMarker
Also badGuy.speed should be in pixel per secondsYann2012-11-24 13:17:46
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Nov 24, 2012 2:10 pm

Thanks for the reply Yann,

I've tried what you've got above but I must be messing something up. The enemies move but they do not change directions.
Here is a screen of exactly what I did.

here is the hyperlink as the insert img is not working for me
click here for pic

Thanks for your help!
MelVin2012-11-24 14:16:37
B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Post » Sat Nov 24, 2012 4:49 pm

is overlapping has no action
trigger once should be put in the same event block as is overlapping
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Nov 24, 2012 5:22 pm

Has this actually helped improve the framerate? Collisions are surprisingly low CPU, since usually 99% of objects in the layout can be immediately determined not overlapping, since their bounding boxes don't overlap.

If you share your .capx I could see if there's anything more likely to be slowing it down.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Nov 25, 2012 3:50 am

Don't know what I would do without you guys:)

@Yann
your spot on, it seems to be working fine now. I just about to test. I'll post back as soon as I have results.Thanks again

@Ashley
Thanks for the offer. It would be great if you would take a look at it. As you can probably tell I'm not a coder, so please be prepared . Any help you can give me would be very appreciated. I want to test first though, try and avoid wasting your time, I'll post back with results and PM you after I'm done. Thanks so much:)

B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Post » Sun Nov 25, 2012 11:13 am

I tested the changes and there was an improvement but not by much. I reworked the spawning of the other enemy classes and now the Fps starts out at 7-8 and increases to about 16-17 by the end of the layout. I'm still lost as to what the cause is.
@Ashley
I will PM you my capx file and info. Thanks for helping.

MelVin2012-11-25 11:14:36
B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Post » Sun Nov 25, 2012 11:56 am

Email sent,thanks again
B
48
S
15
G
5
Posts: 183
Reputation: 8,476

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests