Can you see problems with my code?

Get help using Construct 2

Post » Fri Jan 03, 2014 6:01 pm

Can anyone see any problems in my code that would be using a massive amount of processor power, especially within the "walker movement" category? For some reason, as soon as they spawn they drag the fps way down, each one cumulatively more so. Thanks!

PSI2014-01-03 18:03:06
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Fri Jan 03, 2014 6:07 pm

Couldn't you use the debugger to check what is happening?

It can show exactly what is taking the most processor time.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 03, 2014 6:32 pm

Would you skype with me for a bit sometime?
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Fri Jan 03, 2014 6:38 pm

When I click the profile tab in the debugger it shows how much processor each part of the layout is using. Nothing uses much until I introduce the Walker. I wonder if there might be some kind of problem with the spriter object...
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Fri Jan 03, 2014 6:41 pm

I've got the problem narrowed down to walker movement. It's something in the way they move...
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Fri Jan 03, 2014 6:45 pm

How many active walkers do you have on one layout ?

You are firing 2 foreach loops for them every 0.05 seconds.


you could start by adding 2 sub events to the first for each loop, and move the distance check to the first sub. In the second sub add an else and add the actions from the second loop.

This way you can delete one of the foreach loops with its checks, which should now get handled by the first loop "else" statement.

event:
condition: for each
sub 1: distance check
      actions: etc
sub 2: else
      actions: etc
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Fri Jan 03, 2014 6:45 pm

It's directly in the set angle of motion to angle(Walker.x,Walker.y,Psi.x,Psi.y) part. I wonder why that's causing so much lag.
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Fri Jan 03, 2014 6:46 pm

There seems to be something wrong with my Skype-account..

I'll remove it from my signature untill I figure out what..

I don't know much about spriter, so I can't say if using it to this extent could cause issues.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 03, 2014 6:51 pm

[QUOTE=PSI] It's directly in the set angle of motion to angle(Walker.x,Walker.y,Psi.x,Psi.y) part. I wonder why that's causing so much lag.[/QUOTE]

Put that action in the action directly after the for each loop in what I mentioned above. Will prolly solve it :)

event:
condition: for each
      action: set angle
sub 1: distance check
      actions: etc
sub 2: else
      actions: etclennaert2014-01-03 18:52:40
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Fri Jan 03, 2014 6:51 pm

would setting for each walker as topevent above the every x seconds and removing it in the subevents work?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: iceangel, SERG 04, Yahoo [Bot] and 3 guests