Instant multiple spawn
Atlanten
Member, PRO Posts: 56
Say I want to instantly spawn 100 copies of an actor, how do I go about that?
I can only find ways to spawn one at a time. Using a timer to repeat it seems it doesn't go faster than .1 seconds.
Besides from having 100 instances of the spawn behavior, is there any other way to do this?
Thanks for any help!
I can only find ways to spawn one at a time. Using a timer to repeat it seems it doesn't go faster than .1 seconds.
Besides from having 100 instances of the spawn behavior, is there any other way to do this?
Thanks for any help!
Comments
Spawning takes up a lot of memory. In my experience, just spawning two actors every .25 seconds caused my game to chug a lot (along with a maximum of three other actors spawning every few seconds).
I'd say, for now, that this is impossible, and that it would crash your game, certainly on an ipod Touch...
A spawning tip from the wiki:
"Spawning actors during gameplay is a costly operation, and can cause frames to be dropped. It is best to try to spawn new actors only when necessary for gameplay. Avoid frequent spawning, and try to reduce the total number of actors on-screen at any time."
I'll be proven wrong by one of the GS guys in a minute I'm sure!
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
spawning every 0.001 sec stops here after 20-30 instances ....
spawning every 0.01 sec stops around 280 instances...
hmmm ... interesting )
and its way slower than it should be...
see this test game: http://www.gamesalad.com/game/play/17397
What I need is to have the start area already filled with blocks when the game starts, not having them pop up one by one.
well... i have a very similar game... (doodle jump we are coming )
and i spawn only 15 copies at the beginning of the game to fill the screen...
than when an actor leaves the screen at the bottom i move him to a random position over the top of the screen and let him fall down again...
What I am wondering is how to spawn multiple actors instantly, not one at a time.
In your game, how do you spawn the 15 copies at the start?
Thanks!
Here is one alternative. Think recycling. Have these actors off the visible screen & when battle starts put in a change attribute that set X to random(0,480) & Y to random(0,320). Or whatever numbers you need within the random.
Also, if you're gonna be using the same unit, consider 'moving' it upon being destroy & 'move' it again when you need it to come back into play. This way you're not spawning alot, b/c it will severely slow down your game.
-JGary
15 actors? or 100 actors?
i think spawning 15 actors before the gameplay starts and nothing else is moving shoud be possible?? don't you?
I meant 1/10 of 100. It would probably just crashes by spawning that many. But it can easily preload em.
But its obvious that its better to prevent unnecessary spawning...
ty
Part of the learning process though - any future games we make will bear all this in mind till spawns are made to eat less memory!
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
So to understand the concept of recycling. One of my stages involves navigating an asteroid belt. I have 4 types of asteriods (yes that's going to be reduced to two). I want the asteroids to keep on falling from the top of screen to the bottom. So you can see how the respawning is being used.
This is where I a little confused. If I add the asteroids off screen, at scene start send then down. When then have been hit by a bullet, don't destory them, but make then opaque and move then back to the top of the screen and send them down again. Is that what you guys are recommending?
It's certainly easier to respawn them from a logic point of view, but it will negatively affect gameplay.
You can make pretty much any 2D game you can think of with GameSalad, and have it run nice and fast, you're just going to have to get creative with how you approach the more complicated scenes.
People have been dealing with the slowness/lack of memory in computers since the beginning. The iPhone is a supercomputer compared to the stuff I grew up with. Even though there have always been memory issues, there have always been great games as well. There is usually always a solution to your problem.
But as a developer that's part of the fun!!!!! ;-)
I'm working on a game that uses lots of versions of a single actor. The actor has no image, just a solid color applied within GS, and it doesn't move. It is scaled and rotated and overlaps itself countless times to make irregular walls. The play screen scrolls so most of the time only a dozen or so are visible on screen at once, but the full level has 100+ versions of that same actor. The project size is less than 500k.
Playing it through GS I haven't experienced any slowdown, and that's also with hundreds of particles being generated on the screen. Should I expect a different result with the iPhone? I haven't upgraded since I first wanted to see if the game I'm designing could be made with the software to begin with, but if there really is that much disparity between how a game runs through the game creator and on the actual hardware then I'll probably want to redesign the game from the ground up.
What would be the maximum number of actors a level/stage can have, specifically for an iPhone? And related to that, what would the maximum particles displayed on screen be?
No idea about particles as I prefer preset animations.