Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Creating and deleting particle emitters

Author
Message
nz0
AGK Developer
16
Years of Service
Recently Online
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2011 00:41
When I create a particle emitter thus:

ParticleSet=CreateParticles()

I get an id starting at 10000.

When I dynamically delete this emitter and create another, I get an ID of 10001, then 10002 and so on.

Is this expected? I am not 100% sure the previous emitter was totally deleted if the ID keeps incrementing like this, even though I have removed the old one.

I was only going to allow 10 emitters of this type per level, but my cleanup loop would really like to have an end number to check with GetParticlesExists() for efficiency.

Paul Johnston
TGC Developer
21
Years of Service
Recently Online
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Dec 2011 01:13
That is normal. Rather than check previously assign IDs to see if they have been deleted it just moves on to the next likely free ID. The data structure used to store them can cope with IDs up to 2,147,483,647 so there are plenty of free ones.
nz0
AGK Developer
16
Years of Service
Recently Online
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2011 02:11 Edited at: 16th Dec 2011 02:13
Well, as long as the structure has gone, that's something.
Cleaning up is not as manageable as one would hope.

I think there's scope for some easy cleanup options (as a change request) because it's quite a chore to keep tabs on everything.

I think someone maybe requested a "media clear down" type option for the future - but I was thinking more along the lines of better resource management functions full stop.

At the moment then, the only way is to keep track of them yourself.

[edit] I guess this applies to all other items which are auto-allocated this way?

Login to post a reply

Server time is: 2024-05-05 22:56:09
Your offset time is: 2024-05-05 22:56:09