Questions about actor spawn and destroy

xznkokxznkok Member Posts: 33
edited November -1 in Working with GS (Mac)
Hi
I want to understand clearly about actor spawn and destroy.

Alot of people said spawn and destroy drain memory.

SO in my project, the first scene one actor shoots bullets to one enemy, when the bullets hit the enemy, I hide the bullets and put them in a corner(0,0) instead of destroy them.. when the enemy die, this round over and I reset the scene , and all the bullets of hide of last round is gone.
The question is, when I reload the scene , are the undestroyed bullets auto released of memory? or they are still occupying the memory ? I am confused

Comments

  • AjBlueAjBlue Member Posts: 215
    i hope your not changing the alpha of the bullets onscreen, its much easier placing the bullets in the grey area offscreen. you want to stay away from spawn and destroy and physics if you can. instead of spawning place all objects you want for say bullets offscreen, and make a boolean attribute, when true. change attribute bullets x position, to x on screen. same with y. then the bullet can take its course to the enemy, then once overlapped or collided ( change attribute bullet x to, offscreen position) you need to make 2 change attribute one for the x and one for the y.

    i hope that helps
  • xznkokxznkok Member Posts: 33
    AjBlue said:
    i hope your not changing the alpha of the bullets onscreen, its much easier placing the bullets in the grey area offscreen. you want to stay away from spawn and destroy and physics if you can. instead of spawning place all objects you want for say bullets offscreen, and make a boolean attribute, when true. change attribute bullets x position, to x on screen. same with y. then the bullet can take its course to the enemy, then once overlapped or collided ( change attribute bullet x to, offscreen position) you need to make 2 change attribute one for the x and one for the y.

    i hope that helps

    Thank you for your advice. I tried your way before, however theres too many rules in my bullet actor, if I initially put all my types of bullet there, the FPS will drop down to 45-50 which I think is unacceptable for user may be?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Have you tried just using spawn and destroy? it's really not that bad on memory in my tests. I spent a whole day dealing with trying to get all the recycling stuff to work and then went back to a spawn and destroy method because it seemed to have no effect on the memory.
  • xznkokxznkok Member Posts: 33
    tenrdrmer said:
    Have you tried just using spawn and destroy? it's really not that bad on memory in my tests. I spent a whole day dealing with trying to get all the recycling stuff to work and then went back to a spawn and destroy method because it seemed to have no effect on the memory.

    Yes I tried, but I saw the memory of "game engine" keep increasing in GS viewer. 5 mins after simulation, the game engine reach nearly 24Mb.... I didt use any physics
Sign In or Register to comment.