How do I make object picking more effecient?

Get help using Construct 2

Post » Sat Oct 18, 2014 12:43 pm

I have an event where i have to pick an object which come under certain conditions, and then call a function. This is seems to be cpu intensive at times. I made so that the object picking occurs only once every 3 ticks which has helped in reducing cpu usage, but it also makes the game feel slow. I was wondering if there were any plugins/behavior/tip/tricks to make object picking less cpu intensive.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Sat Oct 18, 2014 12:46 pm

I've never had issues with object-picking being cpu intensive, could you make a screenshot of the events?
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 » Sat Oct 18, 2014 1:03 pm

What measurements have you made that identify this event as the cause?
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,250

Post » Sat Oct 18, 2014 2:21 pm

@Ashley

I think i worded it wrong in haste, but what i wanted to refer to was the 'Pick by evaluate' instance. And when i meant by 'game feel slow' i didn't mean lag, i meant the game progression is based on the picking, and since i made it every 3 ticks, it doesn't progress every tick but rather every 3rd ticks.

Picking by evaluate every tick makes cpu usage high, right?

And also, does cpu utilisation of functions come under 'events' or 'engine' in the debugger?

Thanks.


( I might have worded some things wrong if you are unsure of what i'm trying to say. )
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Sat Oct 18, 2014 2:31 pm

I wouldn't think pick by evaluate would have much impact, unless you have a really high amount of instances..
In which case it would probably not be hard to limit the amount of instances that should be checked by the evaluation..
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 » Sat Oct 18, 2014 4:22 pm

@LittleStain

I actually do have a lot of instances of the object to be checked. How do you suggest limiting the amount of instances?.
I mean how do you limit the amount, without adding more conditions for the picking.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Sat Oct 18, 2014 5:15 pm

What are you tying to achieve? It is taxing to run long loops every frame.
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Post » Sat Oct 18, 2014 9:01 pm

But what measurements made you identify this event even when it ran every tick? Are you sure you are not wasting your time chasing the wrong thing?
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,250

Post » Sun Oct 19, 2014 6:53 am

@Ashley

I placed the event under a group and got the cpu usage of the group from the 'profile' tab in the debugger.

I have a feeling i'm confusing everyone.

It's basically
Pick by evaluate: enemy with half health and enemy is near player > call function ("Set enemy speed to half")

This takes upto 5% cpu when my game is idling and increases on gameplay. Reducing to once every 3 ticks reduces it to about 2% or so at idle.

I'm just trying to to see if i can reduce cpu usage wherever possible.

Thanks
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Sun Oct 19, 2014 8:38 am

For each Enemy, near player, half health, (enemy speed full?) > set speed to half.
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Next

Return to How do I....?

Who is online

Users browsing this forum: Cha0tiXGamer, Google [Bot], ketramtu18, MaujDeveloper and 8 guests