I just recycled my actors and the performance is awesome

PortymanPortyman Member, PRO Posts: 409
edited November -1 in Working with GS (Mac)
Instead of spawn and destroy a missile, I start the level out with 15 missiles offscreen and move them when needed. The mb stay low and do not rise. No slowdowns in fps either. Just had to share.

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    portyman said:
    Instead of spawn and destroy a missile, I start the level out with 15 missiles offscreen and move them when needed. The mb stay low and do not rise. No slowdowns in fps either. Just had to share.

    Brilliant, isn't it? Worth the hassle in the end!

    I've been trying to make a top down shooter for a year, but was never satisfied with performance - maybe now I'll give it another shot!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • hdeandahdeanda Member, PRO Posts: 55
    It would be nice if GameSalad can make a Bullet Behavior that is optimized to do this.
  • PortymanPortyman Member, PRO Posts: 409
    Actually , if gamesald would free up the ram when an actor is destroyed , it wouldn't be an issue
  • HachikoHachiko Member Posts: 330
    Yep, that way is really efficient :)
  • GingerBGamesGingerBGames Member Posts: 390
    Can someone make a template on recycling an actor please? I would be very interested in seening how this is done. Sorry, would someone be kind enough to make a FREE template and upload it please.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    GingerBGames said:
    Can someone make a template on recycling an actor please? I would be very interested in seening how this is done. Sorry, would someone be kind enough to make a FREE template and upload it please.

    If someone doesnt do it before i get home, ill make one for you.
  • QbAnYtOQbAnYtO Member Posts: 523
    what if you have a game where you want unlimited actors (like having alot of enemies running to u until u reach a certain score or event?

    i'm talking about 5 plus enemies on screen (up to 10). you just "move to" them to a certain spot (x and y) offscreen?
  • DreamLabDreamLab Member Posts: 2,127
    I also would love to have a recycled actors template. Would be greatly appreciated!!
    DL
  • madmasseymadmassey Member Posts: 55
    It's really simple. Just drag your actor somewhere in your project away from the main camera. When you want to use it, do something like set BooleanTest = True... then on your actor you have a rule that says When BooleanTest = True, change Self.Position.X and Self.Position.Y of the actor to wherever you need it to be.

    Then when you're done with it, just set Self.Position.Y to 500 or something that'll put it off screen. You can do stuff like put that on a timer so you can Interpolate the alpha to 0 first, in order to have it fade out before it moves away.
  • QbAnYtOQbAnYtO Member Posts: 523
    yea thats exactly what i wanted to do... kill my enemies. have him fade out and move while faded to said destination, the he comes back... awesome! this will freak chris angel's mind! thanks dude!
  • HachikoHachiko Member Posts: 330
    GingerBGames said:
    Can someone make a template on recycling an actor please? I would be very interested in seening how this is done. Sorry, would someone be kind enough to make a FREE template and upload it please.

    You can find it, with cover flow, platform, canabalt, grid for as little as...here it is for free :P
    http://www.mediafire.com/?05cxj3h1l3h7k85
    Click the square to move it around!
  • QbAnYtOQbAnYtO Member Posts: 523
    thanks! too bad can't open it YET since i don't have 0.9 but i saved it, thanks again!
  • AasimarAasimar Member Posts: 74
    portyman said:
    Actually , if gamesald would free up the ram when an actor is destroyed , it wouldn't be an issue

    GS dont free up the ram when actor's destroyed ??
    Crap, my game destroy like... 1 actor by second. bad bad ?
  • simo103simo103 Member, PRO Posts: 1,331
    yeah it is in the wiki on iphone performance:

    http://gamesalad.com/wiki/optimizing_for_iphone

    that being said GS team has indicated they are working on a number of known issues and I'd have to think this is a priority issue.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Aasimar said:
    GS dont free up the ram when actor's destroyed ??
    Crap, my game destroy like... 1 actor by second. bad bad ?

    To be honest I think it really depends on the device. I have tested a shooter layout that used constant spawning enemies dropping from the top and every bullet spawned and while the memory creeped up a little on the 3G I saw no issues on iphone 4 so try it both way to see how you like it. another plus from recycling is reseting your level can be done with out a loading a scene reset which will save time and look much more professional. You will have to search and talk to Darren (utopian Games) to really get that down since he's the master of it. but I think as the new devices come out this is really going to be a non issue regardless of what GS does with it.
  • THRSTNTHRSTN Member Posts: 178
    Hachiko said:
    You can find it, with cover flow, platform, canabalt, grid for as little as...here it is for free :P
    http://www.mediafire.com/?05cxj3h1l3h7k85
    Click the square to move it around!

    Hachiko, thanks man that helps alot but i dont see the cover flow, platform, canabalt, grid in that zip and Free is always great if im lookin in the wrong place let me know cause id love to learn how to make those.
    Thanks
  • quantumsheepquantumsheep Member Posts: 8,188
    What he meant was that it was part of that package, but he's giving the shooting demo for free, which is what the download is.

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • HachikoHachiko Member Posts: 330
    Yep QS, thanks for the explanation :P
    THRSTN, unfortunately I can't give those other one away for free (I sweated a lot on those, especially the canabalt one xD), but if it's for things like these, expect more free stuff (like it always was, but I have to eat now xP)
  • THRSTNTHRSTN Member Posts: 178
    Hachiko said:

    THRSTN, unfortunately I can't give those other one away for free (I sweated a lot on those, especially the canabalt one xD)

    I totaly understand man thanks anyway.
  • SnowSnow Member Posts: 124
    It's cool what you can do with pooled actors. In a couple of my projects I have a system where rows of actors move down 1 x actor-length at a time (example: if actor is 40 pixels high - to shift down 1 length would be "if actor recieves blah event, then actor.y = actor.y-40") and when they go past a specific x or y value, they are moved to the screen and their rules change - such as they can now move or be affected by physics. When they get "destroyed", they are simply moved back to their place in the row or top of the row and follow their old rules again.. er rules for if they're outside of the screen. This system is excellent for grid based games if you want to drop objects 1 at a time onto the grid. The only cons is that you can't get random objects, they are in order of whatever order the row is in.
  • HyryttyHyrytty Member Posts: 39
    I made a thread about this just seconds ago before I noticed that this thread is about the exact same thing, so I'll post here instead..

    "Does spawning/destroying actors slow my performance down? I'm having new actors spawn every 0.1 second. They float up to the top of the screen, and when at the top I destroy them. So in 10 seconds I've spawned 100 of the same actors with different attributes (Sizes/Speed), and in 10 seconds I've destroyed approximately 100 actors also. So does this slow everything down? I've heard people talk about recycling?"

    I'm guessing playing my game for 1 minute will rape the phone up wont it?
  • quantumsheepquantumsheep Member Posts: 8,188
    NahirC said:
    I'm guessing playing my game for 1 minute will rape the phone up wont it?

    Absolutely.

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • PortymanPortyman Member, PRO Posts: 409
    I made doodleroids on the iPad ( similar to that atari game you might have heard of) and every click on the fire button I spawn a bullet and when the action gets thick, there is a noticeable difference in fps. As I started adapting the game for the iPhone, I played with a bunch of new game designs and instead of spawning the bullets, I start off the game with 15 bullets and call them in as I need them. No slowdown of the game at all..... It was a dramatic change.. it has taken a week long project and turned it into a month long saga, but the game is far better because of it. It takes a new way of thnking about our game design......

    < a tear slowly falls from portyman's eye>
  • FranzKellerFranzKeller Member Posts: 517
    I still want to make a nice Raiden type game. ;-)

    here's a question - what about particles? are they automatically recycled, or does that slow things down also?
  • PortymanPortyman Member, PRO Posts: 409
    I don't believe particles are recycled and. They kill performance.....
  • HyryttyHyrytty Member Posts: 39
    quantumsheep said:
    Absolutely.

    QS

    How about now then. I spawn 10 actors every second for 6 seconds. So 60 actors, then I keep recycling them. This is only in the first startscene, then they press Start and that brings them to the game and the spawning stops. Will this kill performance? And when they switch screen will it free all the RAM given to those 60 actors?
Sign In or Register to comment.