To elaborate on the title:
I am currently working with the Löve particle system, and have run into a bit of a snag. I'm loading in the particles (in love.load), and am utilizing the same loaded particle system on multiple entities. It works as planned aside from the fact that the particles are synced among every entity using that specific particle type. I'm still not 100% sure if it's just part of the module or if it's in the way I'm using it. Included is a .gif of the issue:
One way I've thought to solve this issue is to create a function which creates a particle system each time I need to use it (each "crate" has its own number, just send that number to a function to create a new particle system complete with parameters appended with the number of the crate, i.e. silverParticleS##), then just trash collect the information whenever it's no longer needed. However, I'm worried that I will come to regret doing that for performance reasons later on.
I've scoured the wiki pages on the particle system for another way to deal with this issue. Is there a better way than what I've mentioned above? I appreciate any help that can be offered!
Edit: the below image displays what I'm looking to do better. Notice how the two different colour crates have a staggered emission time, whereas the same colour crates above have the same emission time, size, et cetera.
Solution: for any future viewers with the same problem, particleSystem:clone() is the method to use. I created a function which added the clone and a unique identifier to a table, then iterated over that table in an update function. I then used the unique identifier to draw the clone in its specific location by matching the identifier with the object that needs the clones.
How to make multiple instances of one loaded particle "distinct" from each other (solved)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to make multiple instances of one loaded particle "distinct" from each other (solved)
Last edited by Khranos on Wed Dec 21, 2016 1:25 am, edited 4 times in total.
Re: How to make multiple instances of one loaded particle "distinct" from each other
you need to create exactly one particle system per object. how could love possibly keep track of what which of the different invocations should look like?Khranos wrote:To elaborate on the title:
I am currently working with the Löve particle system, and have run into a bit of a snag. I'm loading in the particles (in love.load), and am utilizing the same loaded particle system on multiple entities. It works as planned aside from the fact that the particles are synced among every entity using that specific particle type. I'm still not 100% sure if it's just part of the module or if it's in the way I'm using it. Included is a .gif of the issue:
One way I've thought to solve this issue is to create a function which creates a particle system each time I need to use it (each "crate" has its own number, just send that number to a function to create a new particle system complete with parameters appended with the number of the crate, i.e. silverParticleS##), then just trash collect the information whenever it's no longer needed. However, I'm worried that I will come to regret doing that for performance reasons later on.
I've scoured the wiki pages on the particle system for another way to deal with this issue. Is there a better way than what I've mentioned above? I appreciate any help that can be offered!
You should probably not dynamically create the systems and garbage collect. Just assign them to your 'entity' when you create that and they will get destroyed with it (make sure not to leave any other references obviously).
Re: How to make multiple instances of one loaded particle "distinct" from each other
If I'm not mistaken, I think there's a slight misunderstanding -- I'm fine with all of the particles of said type looking the same, but I'm not okay with them being sent out at the exact same intervals, sizes, and speeds for each iteration I have on-screen.s-ol wrote: you need to create exactly one particle system per object. how could love possibly keep track of what which of the different invocations should look like?
You should probably not dynamically create the systems and garbage collect. Just assign them to your 'entity' when you create that and they will get destroyed with it (make sure not to leave any other references obviously).
Whether I use the same created particle system or create new ones as I go along, I don't particularly care as long as it isn't a code hazard. I've just included an example of more what I'm looking to do in the main post (assuming this was a misunderstanding).
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: How to make multiple instances of one loaded particle "distinct" from each other
Have you checked the wiki? I mean, there is a [wiki]ParticleSystem[/wiki] page, and there are lots of methods to change how the ParticleSystem behaves on the run, if you want more than one the [wiki]ParticleSystem:clone[/wiki] should help.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: How to make multiple instances of one loaded particle "distinct" from each other
Strange, I've looked through that page many, many times. It appears I've completely missed that method! I found it a bit odd that there wasn't a method to use the same system multiple times, so it's nice to know it did actually exist.
After rewriting the system and tons of trial and error, I now have a working particle system. I greatly appreciate the help!
After rewriting the system and tons of trial and error, I now have a working particle system. I greatly appreciate the help!
Re: How to make multiple instances of one loaded particle "distinct" from each other
it's not a clone of the original with it's own timing, I'm pretty sure it will look exactly the same still, unless it has a different seed. And it will still be the same as taking the same values and just making two, except you will probably end up keeping a unused master copy around to clone from.Khranos wrote:Strange, I've looked through that page many, many times. It appears I've completely missed that method! I found it a bit odd that there wasn't a method to use the same system multiple times, so it's nice to know it did actually exist.
After rewriting the system and tons of trial and error, I now have a working particle system. I greatly appreciate the help!
Re: How to make multiple instances of one loaded particle "distinct" from each other
I'm only changing the seed upon loading the game, so I assume that the clone method has something built-in to change the seed. Each individual clone works independently of each other with a satisfying degree of randomness. Each cloned particle even begins in a different way than the last, fortifying the idea that there's something included in the method to modify each for that random feel.s-ol wrote: it's not a clone of the original with it's own timing, I'm pretty sure it will look exactly the same still, unless it has a different seed. And it will still be the same as taking the same values and just making two, except you will probably end up keeping a unused master copy around to clone from.
Who is online
Users browsing this forum: Google [Bot] and 4 guests