A couple runtime "under the hood" questions

0 favourites
  • 3 posts
From the Asset Store
A collection of various characters spritesheets for creating a 2D top down, RPG, tower defense, or other similar game.
  • Ashley

    Two questions: First, does pathfinding use only 1 extra core, or does it use more if they are available?

    Second, I'm trying to optimize for mobile as much as I can - when running an event like this:

    Sprite.var=0

    Sprite.var2=1

    • rotate sprite

    I'm wondering, does the second condition, under the hood, have to still process those sprites that were deselected from the first condition in any way to run the check? Such as, does the JavaScript still have to loop through all the instances to even determine if they are currently picked before checking if the condition is true?

    Same for actions. Do actions have to loop through all instances, even deselected ones, to perform that action?

    Even if very small, is there any remaining performance impact at all from deselected instances in events?

  • Pathfinding only uses one separate thread (web worker). The main reason is Javascript doesn't have a good way to determine the number of cores/optimal number of threads to create. Creating too many workers could result in sub-optimal performance, and one thread on a single core machine shouldn't drag it down too much, so it's the only safe number to go with. The majority of devices are dual-core these days anyway so it's probably a good compromise.

    The event system is relatively well optimised: once an instance has been de-selected by a condition, it is never iterated again (not even just to pass over) by any subsequent condition or action. Events with lots of conditions filter down the selected instances efficiently, only iterating those which met the previous condition. This means you can use a really small micro-optimisation of putting the least likely condition at the top, to reduce the instance count as low as possible initially so later conditions have fewer instances to iterate. However you'd better have tried *everything* else before thinking about such small optimisations, your time is far better off spent on things like rendering (as I'm sure you know).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome, thanks for the info.

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