Which one is more efficient?

0 favourites
  • 7 posts
From the Asset Store
Global plugin that allow for relatively easy and efficient implementation of an in-game inventory system
  • I want to create outfit sprites attached to the characters and adjust the animations accordingly. In your opinion, which one is more efficient? from the following lines:

    ...or I manually change it when the character animation changes:

    I want to see a comparison in terms of resource usage and efficiency in writing code, or from other perspective.

  • The first option only changes when the animations are different so it is really the most efficient although the efficiency gains aren't very big. The second and third (2nd: every tick, 3rd: no condition) are exactly the same. They both happen every tick. The last option is basically an every tick situation but only 1 of the 2 options is happening every tick depending on if the character is moving or not.

    With all that said though, the animation engine, as far as I understand it, will handle all these pretty close to the same. You aren't going to get huge gains from choosing any specific option above.

  • The first option only changes when the animations are different so it is really the most efficient although the efficiency gains aren't very big. The second and third (2nd: every tick, 3rd: no condition) are exactly the same. They both happen every tick. The last option is basically an every tick situation but only 1 of the 2 options is happening every tick depending on if the character is moving or not.

    With all that said though, the animation engine, as far as I understand it, will handle all these pretty close to the same. You aren't going to get huge gains from choosing any specific option above.

    Thanks for the input, yes maybe it's true that it may not have much impact in code that is simple and only involves a few objects.

    I personally prefer the first option, because I prevent the system from continuously carrying out unnecessary processes.

    The last option, I think is not efficient in terms of writing code because I group events based on certain criteria. So that the codes are not spread wildly across various lines.

    Thank you for explaining to me how the system works. I need to get this fundamental information early, so that when the code starts to get complex, I can do code maintenance more easily in the future.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Answer your own performance questions with measurements

    Thank you Ashley

    Sometimes I'm faced with the case that, when I prioritize performance, the code becomes a mess, and vice versa.

    But I think, it would be better to prioritize code neatness as the first move, then performance

  • But I think, it would be better to prioritize code neatness as the first move, then performance

    Absolutely 100% that. Ignore performance until you have a measurable problem, and then use measurements to improve it. See the recently-updated Performance Tips guide for more.

  • Ashley Does have plans to continue updating this blog so that we can see more reasonable uses of events? It would be very helpful to have a clear guide on when to use A instead of B

    construct.net/en/blogs/construct-official-blog-1/common-mis-used-events-gotchas-822

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