particle editor

For questions about using Classic.

Post » Thu Nov 10, 2011 12:42 am

I nearly finished my "circle"
Just one question now: How to change the "rate"

I managed the circle by spawning a sprite(allways) with sin/cos and stuff.
But there are too few particles on the screen.
I tried: allways condition, on every milli second(even tried on 0.01 ms, but didn't worked ><) Also tried to duplicate just the "allways" event with all expressions in it.
But then, he draws the sprites almost at the same place, looks weird :S.

How can I tell him to spawn more sprites ad once?
Timescale just make things faster, raise the "fade out time" isn't really nice to make "more" particles.
zyblade2011-11-10 00:45:40
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Thu Nov 10, 2011 3:20 am

[QUOTE=zyblade] I nearly finished my "circle"
Just one question now: How to change the "rate"

I managed the circle by spawning a sprite(allways) with sin/cos and stuff.
But there are too few particles on the screen.
I tried: allways condition, on every milli second(even tried on 0.01 ms, but didn't worked ><) Also tried to duplicate just the "allways" event with all expressions in it.
But then, he draws the sprites almost at the same place, looks weird :S.

How can I tell him to spawn more sprites ad once?
Timescale just make things faster, raise the "fade out time" isn't really nice to make "more" particles.
[/QUOTE]

That's good news!

Make sure, you work with timedelta to have the "circle" behave the same no matter the framerate.

Now to the question:
You will never be able to spawn anything faster than at the duration of one tick. So something like "every 1 millisecond" doesn't make sense (e.g. running at 60fps the fastest timeslice is 16.67 ms).

Set a rate as a variable, e.g. myrate = 300
It means you want to spawn 300 sprites per second, so you need to know what fraction of a second a tick is.

1/TimeDelta tells you the fps at that moment of time, e.g. myfps = 1/TimeDelta

You now know that you need to spawn myrate/myfps times on every tick

+ for "" from 1 to round(myrate/myfps)
-> Spawn your particle
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Nov 10, 2011 9:13 am

Time to post my .cap.
Left number is how big is the circle.
Right one makes the hole inside bigger.
There is still a "bug". If I set the rate to 600,
The particles doesn't "fillout" the circle evenly.
Sometimes, one part of the circle isn't even filled with particles.
Is it my random method? Or what is it...
http://dl.dropbox.com/u/26932498/particle_spriter.cap
Right now, the rate is 350. With 600 you can see what I mean^^.
Another small thing..If I set the fade to 1000/1000 like the particle object has, it's getting really laggy with even 400 rate. Is it because of my formula?^^ Maybe it could be less complicated/cpu consuming.

thanks for your help. zyblade2011-11-10 09:14:12
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Thu Nov 10, 2011 8:37 pm

Ahhh! It's the clamp thing ><.

I spawn the particles with "random" + sin/cos.
Is there any other way to spawn the particles in a circle?
Because..
Without clamp, I don't know, how to tell the Sprites to keep away from the center^^
And random picks numbers that are(sometimes) below the number "clamp" allows. That's why they get stuck at the same place and it doesn't look good. I find out what's wrong, but still wondering how to fix this.

edit: Got an idea, I'm sure Tulamide knows how to make a selfmade "random"-function. I need one where I can make random(60,120) so I get only numbers from x to y. Can I do that with expressions and events?zyblade2011-11-10 20:48:06
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Thu Nov 10, 2011 9:26 pm

[QUOTE=zyblade] Ahhh! It's the clamp thing ><.

I spawn the particles with "random" + sin/cos.
Is there any other way to spawn the particles in a circle?
Because..
Without clamp, I don't know, how to tell the Sprites to keep away from the center^^
And random picks numbers that are(sometimes) below the number "clamp" allows. That's why they get stuck at the same place and it doesn't look good. I find out what's wrong, but still wondering how to fix this.

edit: Got an idea, I'm sure Tulamide knows how to make a selfmade "random"-function. I need one where I can make random(60,120) so I get only numbers from x to y. Can I do that with expressions and events?[/QUOTE]
First of all: It was a little late last night. The method I provided for spawning at a rate does only work, if the spawn rate is at least 50% higher than the framerate. For v-synced 60 fps the spawn rate needs to be at least 90, etc. I'm sorry about that, but if you will never spawn below that threshold you can safely use such a method.

Yesterday I also started working on sprite particles to help you on this. It is not finished, but all the basics work:
customparticles.cap
It shows in particular how to work with two radii to spawn the particles on a circular band.

To get a ranged random, just add the offset and randomize the distance between the first and second value. To get a random number between and including 60 and 120: 60 + random(61)

I will now dl your cap and have a look at it. But it may take a day.


EDIT: I don't know why, but I get a 404 on your link. This happens quite often with dropbox, but only to me as it seems. :(tulamide2011-11-10 21:39:34
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Nov 10, 2011 10:05 pm

No, it's really 404, check your pms in a few minutes.

I also recognized, that I interchanged the buttons
S and X for the left thing, D and C for the right ones^^.zyblade2011-11-10 22:11:31
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Thu Nov 10, 2011 11:16 pm

Really interesting .cap^^ Just like allways if you post something
I'm too curious right now, gonna look more into your cap and combine things^^. Is it possible to move your particles slightly in one direction?
And how you managed it, that the particles won't "slide" a few cm behind the mouse? Still looking how to turn it on/off xD that slide lol. Really interesting .cap, as I said :P, thanks again for that.zyblade2011-11-11 00:01:22
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Fri Nov 11, 2011 9:17 pm

It is possible not only to move the particles slightly, but to do anything you want with them. You have full control over every single particle at every tick.
The particles don't "slide" because their positions are recalculated on every tick. If you just stop that, they will "slide".

Here is an example of a fire-like ring:


customparticles2.cap


EDIT
Tip: Hold 'space' and slightly move the mouse to get a burn-in effect.tulamide2011-11-11 21:19:30
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Nov 11, 2011 9:33 pm

Thank you^^

Made my day/week/month
Now I will think about the tangential effects.
After that, a little GUI with sliders and it's perfect^^.
After all it's worth a sticky maybe
I come with updates if I get anything new.
Will use your .cap. I could use mine and improve it with your stuff, but I'm lazy and yours is better sorted
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat Nov 12, 2011 7:54 am

Omg. I should start to math all over again.

"RGB(clamp(lerp(GetRed(particle('fadetoColor')), GetRed(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetGreen(particle('fadetoColor')), GetGreen(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetBlue(particle('fadetoColor')), GetBlue(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255))"


What are you talking about. How did you calculate it :). lerp inside of clamp. Sin, cos, tan. I wish I had listened my math teacher on my collage years.

Thank you for sharing.
B
7
S
1
G
1
Posts: 76
Reputation: 904

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests