spawn vs recycle

Howdy

So, what is it about spawn that causes frame rate to drop other then use memory?

it is such a great option to have and simple to use its a shame it slows down the game so much.
il be switching to recycling actors and images but its not going to be as easy

Comments

  • natzuurnatzuur Member Posts: 304
    Spawning actually isn't all that inefficient really, and in some cases i've found it to be more efficient than recycling. However that being said, if you are spawning a very large amount of actors at once, you will get some slow down.

    Images are only going to cause memory usage to increase if they are unique, so 500 actors with the same image won't require that image to be loaded 500 times, just once. However 500 actors means it has to process a large amount of data for each of those actors, so it is likely to cause a spike for that reason.

    Do some smaller scale (not in actor numbers but in a simple project) test in a test project before deciding to scrap your system, you may find recycling to be just as bad.
  • LumpAppsLumpApps Member Posts: 2,881
    I am doing a shooter at the moment and have the bullets spawned. It doesn't harm frame rate much. Perhaps 1 frame less a second. And I spawn one every 0.1 sec.
    I had cases where it did matter and recycle was better but that could be in an older version of GS.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    My understanding is that the spawn vs recycle debate is outdated. Spawns works fine now. I've only ever used spawn and never had any issues.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    yea, spawn/destroy was a huge resource hog 3 years ago, but it's pretty good now.
  • chicopchicop Member Posts: 263
    Ah ok, how ever in my case I am building a simple frame for a game ATM... I have move, shoot, keep score and save score . I spawn a enemy every 2.5 sec and they shoot bullets also spawned. While the player is alive and is destroying enemies it works fine. Frame rate may drop to 58fps but when player dies and the game runs on its really just spawning enemies shooting bullets and the fps drops to 20!

    So I figure the only thing keeping the game smooth is destroying spawned enemies,
  • UtopianGamesUtopianGames Member Posts: 5,692
    edited September 2013
    I remember some of my early videos on recycling (you had to do it back then) but spawn and destroy is now fine so don't worry.

    In your case maybe do if game over is false..spawn enemies or if you want to keep spawning enemies stop them from shooting bullets? So they only fire when your alive?

    Darren.
  • chicopchicop Member Posts: 263
    Thanks Darren for those tutorials your stuff is always really helpful!

    Yes I was thinking the same to limit the spawning
Sign In or Register to comment.