In that situation you may need info from someone from Corona Labs.
First, do you really need 40000 on-screen objects? That’s about 1.5 pixels per object on an iPhone 4. Could you get the same effect with less?
Take any AAA console title of any kind, and it won’t even have a tiny fraction of that many sprites on screen at any time. It may look like it, but it’s simply a well structured lie.
There are a few general, non-Corona solutions, but their applicability is going to depend on implicit details in Corona’s API, and what it is you are trying to do.
A) Batching: I have no idea the full extent of Batching rules in Corona, but essentially Batching is the idea of combining objects with the same render settings into a single Mesh. This reduces Draw Calls, which can be a major stall if done too much per frame. If Corona doesn’t do this, you could have some trouble.
B) Off-screen culling: While the engine should be doing this, sometimes if you know the way your sprites move, you can be more aggressive with it. E.g. Maybe there are larger objects on screen that can obscure major blocks of the screen. Maybe the engine is not doing this (put all sprites off screen and see if it’s the equivalent of setting .isVisible to false). If setting sprites to false is faster, then when you move these particles you may want to do a simple AABB collision test against 0, 0, screenWidth, screenHeight and set visible to false if it’s out of screen.
C) Fakery: Even if a real simulation would involve that many sprites, you only need to make it real enough to convince the user. ALL of game rendering is based on the idea that a close visual estimation is as good as the real thing, but generally MUCH faster. While Pixar can take an hour per frame, game development only gets 16ms. Reduce your sprite count, combine sprites, use audio to emphasize the effect, replace blocks of your sprites with flip-book animations, etc…
If you let me know the effect you want, maybe I can try to give you a more specific solution on how you can fake it.
You can’t simply redraw the new images and not the old each frame without writing a very customised renderer, that works very differently from what you’d find in any game engine, and which would have huge troubles moving any of those objects. [import]uid: 134101 topic_id: 30860 reply_id: 123561[/import]