Game crashed with spawn & destroy behaviors, so I replaced them with recycles...
Sinequanon
Member Posts: 35
...and it still crashes. I used to have behaviors which were spawning new bullets every time something was shooting, and in replaced them with recycling actors. I also pre-generated any power ups. Prior to this, the app was crashing after spawning between 25 and 30 power ups during gameplay. The tweaks I've made have improved the game's memory footprint by 10 mb, and the game now runs (and crashes at) 60 fps. The last crash had the memory at only 40 mb on an iPad 2. Are there any other common reasons a game would simply crash out during gameplay other than memory? Or any other hidden processes that are memory intensive (I am using a decent amount of interpolated and writing to game/global attributes)?
Comments
I was monitoring the iPad's console in Xcode when it was spawning and destroying, and the crash log definitely indicated that the program ran out of memory, though I haven't tried the same since replacing the behaviors. I will now proceed to scour my actors. Fun time.
The way it is built, there should be no difference between the game idling and the game in action in terms of new objects being created. All of the bullets and powerups have been spawned and are sitting off in a gutter at 800, 800 (this is an iPad game), waiting to be called. If I try and shoot a bit, it works fine.
The only thing there is to do now are to destroy bricks with your bullets. Doing so causes a brick to move off-screen for a random time and then to reappear at its location. Once I began doing that, with the game that had been idling peacefully for 5 minutes, it crashed. So I'm going to check out the attributes for the bricks...
When <this> Collides with object of tag Wall
Change Attribute self.position.X (real) to self.gutter (int)
Change Attribute self.position.Y (real) to self.gutter (int)
Or is this not an issue in GS?