Author Topic: Particle effect testing  (Read 5518 times)

0 Members and 1 Guest are viewing this topic.

Particle effect testing
I've been playing with the Particle Effect from the wiki ( http://wiki.hard-light.net/index.php/Particle_Effects ), trying to work around the issues I had with the Death flash script (lag, not working on debug builts) and the description of "$Ship Death Effect:" ( http://wiki.hard-light.net/index.php/Ships.tbl#.24Ship_Death_Effect: ) seemed just to fullfill all my needs. When I used it however, the effect that worked with the script did not show up, not matter what I did.

First I've tried something that equals the description on the wiki:

Code: [Select]
#Particle Effects
$Effect: TestTest
$Type: Single
+Filename: ExpFlashBlue
+Size: (19000)
#End

After that didn't worked I also took a look at the JAD table, but it did not work either. (I did a couple more attempts, but neither worked).

Code: [Select]
#Particle Effects
$Effect: TestTest
$Type: Single
+Filename: ExpFlashBlue
+Size: (19000)
+Lifetime: (1000)
+Duration: Always
#End

The only thing there was in the Debug log is following:

Quote
TBM  =>  Starting parse of 'ExploNew-part.tbm' ...
BMPMAN: Found EFF (ExpFlashBlue.eff) with 39 frames at 10 fps.

Any thoughts?
« Last Edit: December 29, 2018, 07:05:47 pm by Nightmare »

 
Re: "$Ship Death Effect:" not working
OK, I've managed to find the problem- apparently $Ship Death Effect: is simply not working. I used the same TestTest particle effect as weapon impact, and it worked properly. One thing I've noticed though, is that the quality of the effect is extreme low, as if the resolution of the effect used (1024*1024 png) would've been just 64*64 pcx files. In case somebody wants to fix this someday, would it be possible to have them in full quality (or atleast, higher)?

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
 :banghead:

Quick test, try to add a dummy effect before your real particle effect. That should fix it. This is another instance of stuff not working because a single character is missing. While I'm working on the particle code I might as well fix this by using a better type for these handles...

EDIT: This should fix the death effect: https://github.com/scp-fs2open/fs2open.github.com/pull/1797
« Last Edit: July 15, 2018, 01:23:20 pm by m!m »

 
Re: "$Ship Death Effect:" not working
Ah, OK thank you! :) :yes:

Maybe you could link the detail level to "+Size:" of the particle effect? I like the idea of having some sort of native "Death flash" rather than the scripted one, but it looks horibble underdetailed (I can add pics if required).
« Last Edit: July 15, 2018, 01:39:00 pm by Nightmare »

 
Re: "$Ship Death Effect:" not working
I've got another problem. I'm using following code:

Code: [Select]
$Effect: Hecate
$Type: Composite
+Child effect: $New Effect
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (500)
+Number: (1)
+Direction: Reflected
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (150)
+Lifetime: (6)
+Duration: Always
+Duration: (4)
+Delay: (2)
+Child effect: $New Effect
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (1250)
+Number: (1)
+Direction: Reflected
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (150)
+Lifetime: (4)
+Duration: Always
+Duration: (4)
+Delay: (2)

As far as I understood the wiki, I should be seeing 2 effects, each with a particle trail; with effect generation starting 2 seconds after the effect is triggered (i.e. ship destroyed) and last for 4 seconds. The delay works as far as I can see this, but the engine creates about 2 dozen effects from this, and every number larger than 2 entered in "+Number:" will cause FPS to drop below 10.

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
Do you have a test mod I could test this with? That would make it much easier to reproduce and fix this bug.

 
Re: "$Ship Death Effect:" not working
I've noticed another thing- while using these tables with my mod, they create a sphere, but when I'm using the isolated files they always only produce a forward cone, even though I use exactly stats. It's still a forward-only cone if I set "deviation" to 360. The problem with the number of generated effects is the same, however.

[attachment eaten by a Shivan]

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
Thank you very much! That will help me immensely. I can reproduce the bug so I'll investigate what is going wrong here.

 
Re: "$Ship Death Effect:" not working
Thanks for your efforts! :)

One thing that I forgot to say - I'm wondering that I have to specify "+Duration" 2 times in a row. As it's only a optional field, I don't understand how the game can distinguish whether it was relating to the main effect or the particle trail if only one is specified.

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
When the engine parses a $New Effect construct it consumes all the options that are possible for that effect. So, when the engine is at line 18 of your file it is currently in the process of parsing a "Single" type effect. "+Duration" is a valid option for that so it will use that if it exists. If you specify that in line 18 (regardless of indentation) then the engine will not be intelligent enough to figure out that you may want to specifcy that for the "Cone" effect.

That is actually a bug in the parsing code since such ambiguities should be avoided when writing such code. I will have to do something clever here to avoid breaking old tables but I will move the +Trail effect: to the end of the list which will fix that ambiguity.

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
So, I figured out what is wrong here. If you specify a duration for an effect that means that for that time new particles of this effect are generated. So, with your config the engine would try to create effects for 4 seconds after the delay. That gets cut down to a lot less since the host of the effect (the ship) is invalid shortly thereafter but there are still a few frames in which the engine will create new particles with particle trails.

So, if you want to only create very few particles you should specify a very short duration for the Cone effects. You can't use "Onetime" though since that only works if you don't specify a delay.

Even though I think the described issue is a configuration issue you still found some issues that I improved upon so I'll submit a pull request with those changes soon.

 
Re: "$Ship Death Effect:" not working
So +Number is not good for handling how many effects are being created? I hoped that  if I set +Number to, say, 60 and duration to 4 that 15 effects are being created per second. Would it be possible to implement something like that in in the future, possibly through a new option? It would make the effect easier to specify, as it seems to be a guessing game right now (one that is a bit hard to solve, for me at least).

 

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
No, that is not how +Number works. That specifies how many particles are created per frame.

A "particles per second" specifier would be interesting but I'll have to think about how such an option could be implemented in this system since the system is specifically designed to that sources do not have effect type specific data in them so I'll have to figure out a generic way of producing a consistent number of particles per frame even if the frame rate is very high or very low.

 
Re: "$Ship Death Effect:" not working
OK I didn't knew that, the only thing the wiki told me about +Number: was

Quote
Sets the amount of created particles.

  

Offline m!m

  • 211
Re: "$Ship Death Effect:" not working
Yes, that's pretty vague. I changed it to be more precise.

 
Re: Particle effect testing
I'm sorry but I found some more issues (and I had a couple ideas).

-1. Would it be possible to define how many effects "+Trail effect:" creates, something like "+Time:" in $PSpew: at the weapons.tbl? So far, it just keeps making as many as it can until my FPS drops to 30 or below, what is far more than what I would need.

-2. I had the idea that it could be possible to evade the current lack of a "Effects per second:"-feature by creating the same effects several times in a row (with "+Delay:" being the only difference - for example 1, 2, 3 etc). However, when I use +Delay: without specifying +Duration: (see table below) I receive following error although the Wiki does not indicate a dependency as both are optional fields:
Code: [Select]
Error: ExploNew-part.tbm(line 47):
Error: Missing required token: [#End]. Found [(2)] instead.

File: parselo.cpp
Line: 303
I managed to work around this issue though by setting Duration to 0.1 though.

-3. If you quit/reload the mission while the particle effect is active, the next mission you load (or the reloaded mission) will have a lower standard FPS rate. For example, my test mission had 60 FPS as standard (which is also pretty much the default on my PC). After reloading, the exact same mission had a FPS standard of 30-40 FPS using the 29th December Nightly. For some reason this only seems to occur when my FPS drops below 30 during the active effect.

-4. While I have no clue about coding, I just had an idea regarding the "constant particle generation at dynamic FPS" needed to define "+Particles per Second:": I remember that for quite a long time there was a bug with beam damage variating at different FPS or time compression, but I was told it has been fixed in the mean time. Could it be helpful to look at that code, or maybe the one used for $PSpew:?

Test table (the rest is still the same):
Code: [Select]
$Effect: Hecate
$Type: Composite
+Child effect: $New Effect;Inner Part
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (500)
+Number: (10)
+Direction: Reflected
; +Duration: (0.1)
+Delay: (2)
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (200)
+Lifetime: (6)
+Duration: Always
+Child effect: $New Effect
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (500)
+Number: (10)
+Direction: Reflected
; +Duration: (0.1)
+Delay: (3)
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (200)
+Lifetime: (6)
+Duration: Always


+Child effect: $New Effect;Outer Part
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (1250)
+Number: (22)
+Direction: Reflected
; +Duration: (0.1)
+Delay: (2)
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (200)
+Lifetime: (4)
+Duration: Always
+Child effect: $New Effect
$Type: Cone
+Filename: CapFlash
+Size: (15)
+Lifetime: (4)
+Deviation: 180
+Velocity: (1250)
+Number: (22)
+Direction: Reflected
; +Duration: (0.1)
+Delay: (3)
+Trail effect: $New Effect
$Type: Single
+Filename: exp20
+Size: (200)
+Lifetime: (4)
+Duration: Always

 
Re: Particle effect testing
Anybody? :nervous:

 
Re: Particle effect testing
Is there some coder who still cares about the things above, now or at some future point? Especially something with that Particle Trail effect creation could be tamed would be useful...
« Last Edit: January 09, 2019, 06:49:03 pm by Nightmare »

 

Offline m!m

  • 211
Re: Particle effect testing
Sorry, I forgot to answer here...

I will try to take a look at this soon but unfortunately I cannot promise anything.

 
Re: Particle effect testing
Alright - no pressure here, I just wanted to know if there was a chance for this within the next months or whether I should work on something different. :)
« Last Edit: January 10, 2019, 03:49:46 pm by Nightmare »