**Constrain Optimization Question + Efficient Method**

Hey everyone, quick question:

Which of the following is more performance heavy?

Constrain (self.image) to (game.score)
// OR //
When (0.04) > (game.Time)%3, Change (self.image) to (game.score)

Is the difference still negligible in a larger game? Thanks for any input.

Comments

  • ShineHouseGamesShineHouseGames Member, PRO Posts: 100
    I've been using, from my observation, a rather efficient method:

    When (self.image) /= (game.score)

    {Do nothing}

    Otherwise:

    Change (self.image) to (game.score).
  • ShineHouseGamesShineHouseGames Member, PRO Posts: 100
    Bump? Any thoughts?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey there,

    To be honest, I think all of the ways listed are pretty equal, performance-wise.

    Both Rules and Constrains fire as often as possible, too many of either will start to bog down the system.

    I think I might actually prefer the Constrain in this case, because it is not doing any logic.
    Although constantly changing an image all the time is probably a pretty heavy thing too!

    So always change an image a zillion times a second, or perform some logic a zillion times a second, and then also change the image but not as often!

    A good question!




  • ShineHouseGamesShineHouseGames Member, PRO Posts: 100
    Thank you! Very cool.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2013
    Anytime you slim down the code it's better overall it's less code that needs to be scanned. One trick I use is if say on a long scene I tell things to stop doing what they do until the my main actor gets closer to them, aka 800 pixels away.
Sign In or Register to comment.