Can anyone explain what's happening in the attached pic?

Get help using Construct 2

Post » Mon Oct 20, 2014 7:08 pm

Image

Group and Group2 are groups that i've placed inside triggered functions which in turn are inside the group 'm' which in turn is in group 'three=1'

Why is group 'm' showing 0% and -30.2% self? Negative sign?
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Mon Oct 20, 2014 7:21 pm

@PANDY Without a CAPX its hard to fix it. I am guessing you have some sort of variable that is set to subtract 1 on a certain action. You may need to not allow it to go past 0. But without seeing the whole event sheet no way to know for sure.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Mon Oct 20, 2014 7:34 pm

robertjs3 wrote: I am guessing you have some sort of variable that is set to subtract 1 on a certain action. You may need to not allow it to go past 0.

I don't think this is related at all.

@Pandy this might be a bug on the debug engine, try to reproduce it in a minimal capx and post a report. Or you can opt showing some screenshot of the group, or just attaching the capx will do as well so that others with idea can point out why is it like that.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Tue Oct 21, 2014 12:11 am

@DUCKFACENINJA yea maybe it isn't, just taking wild guess, haha.
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Tue Oct 21, 2014 3:47 am

@DuckfaceNinja

Ok, will do.

Can you clarify one thing for me please.

Triggered functions take up cpu too as well ,right?

For example. Enemy near player > call function("enemy slow")
and on function("enemy slow") > enemy speed half and enemy fire rate half and etc etc .....

Imagine that the function calls a lot of actions ,like 10 or so. This would make cpu usage high.

My problem was that the cpu usage for functions in groups were barely showing 0.2%. That's why i put the group(GROUP and GROUP2) withing the triggered functions ,and then i got such high values and also the weird total group cpu usage.

It's all irritating now, especially when i'm trying to make the project more efficient.

Thanks for your input anyways, i'll upload a capx when i'm done with the days work.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Tue Oct 21, 2014 4:01 am

Pandy wrote:Can you clarify one thing for me please.

Triggered functions take up cpu too as well ,right?

For example. Enemy near player > call function("enemy slow")
and on function("enemy slow") > enemy speed half and enemy fire rate half and etc etc .....

Imagine that the function calls a lot of actions ,like 10 or so. This would make cpu usage high.

My problem was that the cpu usage for functions in groups were barely showing 0.2%. That's why i put the group(GROUP and GROUP2) withing the triggered functions ,and then i got such high values and also the weird total group cpu usage.

I'm not sure about this, but I do have a single function with 97 action in 54 lines, no performance impact at all, so amount of action doesn't affect anything significant. This will have to do with what condition/action you're doing, what I know is a heavily nested loop can give a bit of hiccup if there's too much looping on object creation/destroy, there are other extreme cases as well.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Tue Oct 21, 2014 4:26 am

@DuckfaceNinja

Yeah, i just realized my function calls another function which in turn calls itself. Group calls group2 which in turn calls itself. I guess there's where the issue is. Top of that it occurs for multiple objects.

Function calling a function is kind of a nested loop, right? . Now i have to rework them argh.

Thanks for the help.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Tue Oct 21, 2014 5:04 am

Pandy wrote:Function calling a function is kind of a nested loop, right? . Now i have to rework them argh.

That sounds like recursive functions. You have to be careful not to create infinite loop of function call, you need a way to exit the loop, it can lead to browser freeze and crash. I did an infinity loop before and I would say it's a bad practice at least for me.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Tue Oct 21, 2014 7:20 am

My functions have to pick an object, so i guess it exits once it can't find any object under the picking conditions. I'm guessing recursive functions are still cpu heavy if you have a lot of objects that take part in the loop.
B
16
S
4
Posts: 138
Reputation: 1,454


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 1 guest