I'm making a mobile game:
[vid]http://a.pomf.se/iakcef.mp4[/vid]
Here's the code:
[url]http://hastebin.com/gurajiqeje.lua[/url]
I've hit a limit on how many particles I can spawn, though. Entities being spawned (and removed) every frame brings my phone down to about 40 fps, and 15 during bursts. I realize re-sorting all of my entities every frame is less than ideal, how can I optimize this while still retaining draw order? Side note, what do you think of my OOP system?
I don't know much about LOVE but I don't seem to see caching. If you're not caching, you should. Reuse objects instead of destroying and creating new ones each frame.
If you are doing that though, my apologies.
Sorry for offtopic but are you coding it from your phone?
What's the app?
[QUOTE=AnonTakesOver;47522315]Sorry for offtopic but are you coding it from your phone?
What's the app?[/QUOTE]
DroidEdit
[QUOTE=itisjuly;47521962]I don't know much about LOVE but I don't seem to see caching. If you're not caching, you should. Reuse objects instead of destroying and creating new ones each frame.
If you are doing that though, my apologies.[/QUOTE]
Doesn't seem to be the case. Usually love already has its own ParticleSystem object that uses pooling and such, but I don't know if that's available on this android port.
[QUOTE=Ott;47515568]I'm making a mobile game:
Here's the code:
[url]http://hastebin.com/gurajiqeje.lua[/url]
I've hit a limit on how many particles I can spawn, though. Entities being spawned (and removed) every frame brings my phone down to about 40 fps, and 15 during bursts. I realize re-sorting all of my entities every frame is less than ideal, how can I optimize this while still retaining draw order? Side note, what do you think of my OOP system?[/QUOTE]
Are you sure particles need sorting?
Your issue is almost guaranteed to be a result of allocation. It might be worth trying to reuse tables, because when you let them get gc'd, you're recreating them, which allocates a specific table size, then inflating them with members, which increases them all over again and can be expensive for some devices.
This isn't typically something you'd have to worry about the on PC, but it seems to be a noticeable issue on your phone.
Hmm. For now,I've made a special kind of particle that teleports to the player and resets itself when it's supposed to die. I'll take a look at ParticleSystem.
Sorry, you need to Log In to post a reply to this thread.