• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Delta time and particle system

T

TheGreatThibal

Guest
Hi guys,

just a quick question.
Is there any possible way to adjust the build in particle systems speed, lifetime etc. to delta time, or am I forced to use my own system?
I know that I can update the particle system manually, but that doesn't bring me anywhere, because I obviously can't update the system every frame.

Thank you
 
T

TheGreatThibal

Guest
So, not a very popular topic I guess...

As far as my researches go I couldn't find a solution with the build in particle system and delta time, so I build my own little thing with objectpooling using ds_stacks.
Works fine for what I am doing.
 

Bingdom

Googledom
I'm pretty sure you can. Once the delta timing has exceeded the value of 1, you update it a number of times it has exceeded 1.

e.g.
del is a variable that stores previous lag.
The game has spike lagged, delta increased the variable "del" by 3.32. So now del equals 3.88.
You would do something like this
Code:
del += (delta - 1);
if del >= 1 {
for (var i =0; i<del; i++) {
  part_system_update(ind);
}
del = del - floor(del);
}
Something like that.
 
T

TheGreatThibal

Guest
Hm..
So let me do an example to make sure I do understand want you mean.

Right now my delta floats around 1 at 60fps
Let's say that the pc the game is running on can only manage push out 45fps, that would result in delta around 1.5 of I'm correct.

I know, that if the delta would be 2 for example you would update the particle system 2 times a frame. But what about the 0.5 step, when delta is 1.5 like the example above?
That would basically mean that the particle system had to be updated an additional half step?
 

Bingdom

Googledom
Particles aren't a critical thing. I'm pretty sure leaving that .5 to stack up on the next lag would be fine.

I don't think particles should be Delta timed anyway... It would just add more processing power towards to nothing that effects gameplay.

(Btw, 45/60 = .75, Delta = 1.25)
 
T

TheGreatThibal

Guest
My goal with delta time is to build a solid solution to run the games I make at any possible framerate, at the same speed. In the worst case that could mean, that if the player chooses to not use vsync, the framerate would be in the hundreds. If I don't adjust the partciles timings, they would be so ridiculous fast, the player wouldn't even see them.
And even though it doesn't effect gameplay, I think the use of particles are a vital visual element to bring some life in the games I make.
I think I will try your solution in an isolated project and see how that works. For now I'm happy with my self build system, as it does what I want perfectly.
Thank you
 
Top