Creating +50 objects, how?

Hi,

I’m just learning working with gdevelop.

I noticed if I create more than 50 objects per seconds the engine just get frozen and I have to quit my game.

Not sure is it limitation of my laptop, limitation of engine or limitation of my bad event sequence?

I think my events are OK and the game is very simple. You can imagine it as a bullethell game where are a lot of bullet objects created per millisecond. Objects are small in size like 3x3 pixels.

Spawning so many objects is necessary for my game, also they get automatically deleted with collision or off screen so I don’t understand what’s wrong, why it gets frozen?

Thank you

how are you doing it?
NORMALLY you would prefer an Repeat type event rather than call an spawn function 50 times in the same event

my JS knowledge is limited, but as far as i know we have this “;” which is used in the end of an line to tell to JS that line ended, is not literally that for the events functionality, but if you call 50 times the same action gdevelop will never take an breath you know? with repeat it can inhale an exhale more easily

so use the Repeat 50 times type event and create your objects

Welcome Vetruns. Can you post a screenshot of your events?

You can use the debugger to get a true count on the number of objects. 50 objects doesn’t seem unreasonable. There could be more than you expect. GD tries for 60 frames a seconds, so things can get out of control quickly.

https://wiki.gdevelop.io/gdevelop5/interface/debugger/

The biggest cause of freezes are infinite loops from a while event or huge repeat or too many objects or some other form of memory or resource shortage.

Have you got behaviours attached to them - that can make a difference - you should be able to cope with thousands at once if there’s not many events or behaviours attached to them. As Keith says - it might be that there’s more than there appears to be. You can use a text object and set the text to the number of instances on the scene to check whether this is the case.ToString(SceneInstancesCount(object))