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.