Performance & Movement

  • Hello,

    I have an easy question.

    I try to design my game as performance optimized as it can be.

    What calculates faster?

    Option 1:

    object 1 - move at angle 180? -4*dt

    object 2 - move at angle 180? -4*dt

    object 3 - move at angle 180? -4*dt

    I think this is the slowest method, because the game has to calculate the degree ?.

    Option 2:

    object 1 - set X to self.X-4*dt

    object 2 - set X to self.X-4*dt

    object 3 - set X to self.X-4*dt

    This I think whould be the second fast, as the game has to check every objects X and than substract from this value.

    Option 3:

    object 1 - set X to self.X-4*dt

    object 2 - set X to object1.x

    object 3 - set X to object1.x

    Finally I think option 3 is the fastest as it has only to calculate the first object and than simply check the first objects X coordinates for the other two objects.

    Am I right? The difference is probably not noticeable at all but maybe if I whould have 100+ objects.

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are trying to move all three objects to the same position every tick...then yes, technically speaking, the latter option should be the fastest.

    You are unlikely to notice the difference though, even with many hundreds of objects.

    As is often said: C2 has a tendency to slow down from graphics, not logic, though there are exceptions (bullet hell shooters, as I have discovered...)

  • Good to know. Thank you.

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