A lot of actors vs. A lot of edited instances

MarkOnTheIronMarkOnTheIron Member Posts: 1,447
edited November -1 in Working with GS (Mac)
I don't seem to find it anywhere.

I wanted to know if, in terms of overall performance, it is better to have a lot of actors that do essentially the same thing or it is better to have only one actor and edit all its instances?

In my case it's about an actor that display a text related to an attribute. I want to display 40 to 50 attributes in various scenes, can I use the same actor and manually chance the attribute in its instances? How much memory is lost/gained?

Comments

  • ZillaZilla Member Posts: 157
    I am also interested in this issue.
    Any info from a GS official dev?
  • StarhunterStarhunter Member Posts: 6
    It's best to have one actor and have the same instances in all of them. BUT, don't think there's no way to make the actors have varying performances with the same attributes.

    In a game I'm working on I have one ball actor and one ball spawning actor. The spawning actor spawns balls at random intervals and the ball actor has a random speed and direction of movement. This system creates a very mixed feel using only 2 actors.

    Hope this helps.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Another example could be this:

    Let's say I have a puzzle game with 100 levels and on each level there's a message on the end that say "You completed the game in xxx seconds". Which is better: to have 100 different actors that display the message or only one actor and edit its instance on every level with that level time attribute?
  • rebumprebump Member Posts: 1,058
    For the post above, I would have one actor prototype that displays the "You completed the level in XXX seconds." message. Then just have an instance of that actor prototype per level. For the message, you can use the string concatenation operator (..) to string the text with the actor attribute for "TotalSeconds" or some level timer or however you are computing the time taken.

    Edit: For some reason, I originally typed the modulus operator (%) instead of the string concatenation operator (two periods) above. I fixed it above. Hope I didn't confuse you.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I would (and do) edit the instances. That is the beauty of the object oriented approach...one prototype, many instances.

    I believe you can update the attributes on the left side of the instance without a hit in performance. Adjusting the behaviors (on the right side, with the padlock) might be a bigger one - hence the padlock.

    There is also the overall file size of the app to think about... no sense wasting 100K on the same actor over and over...
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Thanks.

    I change the left side attribute all the times to adjust position and size, but what puzzled me the most was the right side and I was worried if the padlock was there to help GS users to avoid errors or if it could cause some problems on performance or else.
Sign In or Register to comment.