How do I make object picking more effecient?

0 favourites
  • 11 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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.

  • I've never had issues with object-picking being cpu intensive, could you make a screenshot of the events?

  • What measurements have you made that identify this event as the cause?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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. )

  • 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..

  • 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.

  • What are you tying to achieve? It is taxing to run long loops every frame.

  • 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?

  • 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

  • For each Enemy, near player, half health, (enemy speed full?) > set speed to half.

  • Katala

    Yeah, but then the game has to check every tick if each enemy is near the player. I just wanted to know if there was any workaround for the game having to check every tick for any condition for any object.

    Thanks anywyas

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)