Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Spoon on October 03, 2017, 02:32:28 pm

Title: Particle effects - Cone not quite working right
Post by: Spoon on October 03, 2017, 02:32:28 pm
Today I've been spending quite sometime learning how to wield the new Particle effects (http://www.hard-light.net/wiki/index.php/Particle_Effects).
The wiki page documentation is... Well, let's just say that the formating could use some work on making things clearer for the end user. But through much trial and error, I more or less got an handle on it now, at least.

The issue I've run into though, is that the Cone effect only seems to work properly on laser impacts. Whenever cone is assigned to a beam impact, or a missile launch, the direction of the particles being spawned will always be sideways. And reverse will just make the particles spawn sideways to the other side.
So far I've had this happen while trying to use a Cone effect on $Freeflight Effect: and after much fiddling just resigned myself to using a bunch of Single effects instead. Because it just wouldn't spawn in any direction but sideways.

This for example, results in
Code: [Select]
$Effect: BreakerBeamImpact
$Type: Composite
+Child effect: $New Effect
$Type: Single
+Filename: flashexp
+Size: (30 35)
+Lifetime: (0.2)
+Child effect: $New Effect
$Type: Cone
+Filename: missilespew05
+Size: (0.65 0.75)
+Lifetime: (3.45)
+Deviation: 7
+Velocity: (150 175)
+Number: (2 4)
+Direction: Normal
+Child effect: $New Effect
$Type: Cone
+Filename: missilespew06
+Size: (0.65 0.75)
+Lifetime: (3.65)
+Deviation: 8
+Velocity: (125 150)
+Number: (2 3)
+Direction: Reverse
+Child effect: $New Effect
$Type: Cone
+Filename: missilespew03
+Size: (0.65 0.75)
+Lifetime: (4.00)
+Deviation: 5
+Velocity: (125 150)
+Number: (3 4)
+Direction: Normal

(https://i.imgur.com/0Yr42if.png)
Title: Re: Particle effects - Cone not quite working right
Post by: m!m on October 03, 2017, 03:02:35 pm
The issue with the beam impact seems to be caused by a missing particle source direction and that was easy to fix. For the weapon in-flight effect I'll have to create a test-case so that might take some more time until I can determine what's wrong there.

What could be improved in the wiki article? I did my best with the layout but I am not familiar with what an end user would expect from the documentation of this feature.
Title: Re: Particle effects - Cone not quite working right
Post by: Spoon on October 03, 2017, 03:35:01 pm
The issue with the beam impact seems to be caused by a missing particle source direction and that was easy to fix. For the weapon in-flight effect I'll have to create a test-case so that might take some more time until I can determine what's wrong there.
  :yes:
You work quick (:

What could be improved in the wiki article? I did my best with the layout but I am not familiar with what an end user would expect from the documentation of this feature.
The primary issue when I look at the wiki page, is that I can't tell at a glance in what order everything goes. While I get the intention behind having links going to the Common syntax constructs. It makes everything really unclear and confusing at a glance, and makes it tedious when repeatedly having to look things up. Rather than having the links, It's much better to just repeat the information for each effect entry.
Also, there's no clear visible seperation between Single, Composite, Cone and Sphere (no spaces, or lines, or colors etc), it looks like its one big list, which adds to the confusion when trying to make sense of it as a first time reader.

I had to make my own list in a notepad so I could tell at a glance how many inputs Single, Cone and Sphere actually take. Since on the wiki page, I constantly have to scroll down and up and try to piece things together. Look at Ships.tbl and the Weapons.tbl wiki pages for example, the contents list has everything in the order that the game expects it in.
Code: [Select]
Single
 +Filename:
 +Size:
 +Lifetime:
 +Duration:
 +Delay:
 
Cone
 +Filename:
 +Size:
 +Lifetime:
 +Deviation:
 +Velocity:
 +Number:
 +Direction:
 +Trail effect:
 
Sphere
 +Filename:
 +Size:
 +Lifetime:
 +Velocity:
 +Number:
 +Direction:
 +Trail effect:

My notepad list after some puzzling and trial&error.
Title: Re: Particle effects - Cone not quite working right
Post by: m!m on October 04, 2017, 03:27:08 am
I tried to reproduce your missile issue and I did find an issue which caused the particle source to disappear after just one frame but I can't reproduce your issue where the particles would spawn sideways.

The primary issue when I look at the wiki page, is that I can't tell at a glance in what order everything goes. While I get the intention behind having links going to the Common syntax constructs. It makes everything really unclear and confusing at a glance, and makes it tedious when repeatedly having to look things up. Rather than having the links, It's much better to just repeat the information for each effect entry.
Also, there's no clear visible seperation between Single, Composite, Cone and Sphere (no spaces, or lines, or colors etc), it looks like its one big list, which adds to the confusion when trying to make sense of it as a first time reader.

I had to make my own list in a notepad so I could tell at a glance how many inputs Single, Cone and Sphere actually take. Since on the wiki page, I constantly have to scroll down and up and try to piece things together. Look at Ships.tbl and the Weapons.tbl wiki pages for example, the contents list has everything in the order that the game expects it in.

I guess I tried to optimize the size of that that page too much :p I'll fix that as soon as all these bugs are fixed. I have to build a test mission to check if the beam impacts are really fixed now but that shouldn't take too long.

EDIT: I found more bugs in the beam code and fixed those too. I have submitted the changes for code review: https://github.com/scp-fs2open/fs2open.github.com/pull/1493
Title: Re: Particle effects - Cone not quite working right
Post by: Spoon on October 04, 2017, 06:59:40 am
I neglected to mention that it was a missile launched by a turret, which is probably relevant information!

I guess I tried to optimize the size of that that page too much :p I'll fix that as soon as all these bugs are fixed. I have to build a test mission to check if the beam impacts are really fixed now but that shouldn't take too long.

EDIT: I found more bugs in the beam code and fixed those too. I have submitted the changes for code review: https://github.com/scp-fs2open/fs2open.github.com/pull/1493
  :yes:
Title: Re: Particle effects - Cone not quite working right
Post by: m!m on October 04, 2017, 07:31:52 am
Ok, I can reproduce the issue now and the only reason I didn't see the issue before was that the ship I fired the missile from was pointing along the z-axis which is also the direction the bugged particles travel on by default :banghead:

EDIT: I think I fixed the missile issue as well now. The changes are in the same PR as the other fixes.
Title: Re: Particle effects - Cone not quite working right
Post by: m!m on October 05, 2017, 03:24:56 am
I overhauled the documentation based on the comments in this thread: http://www.hard-light.net/wiki/index.php/Particle_Effects
I also added a few clarifications to how the syntax of uniform ranges works and added an explanation for when Normal is not a valid source direction.
Title: Re: Particle effects - Cone not quite working right
Post by: Spoon on October 05, 2017, 05:50:24 am
Much better! Nice job  :yes: :yes:
Title: Re: Particle effects - Cone not quite working right
Post by: Spoon on October 24, 2017, 09:16:43 am
One other thing I ran into, this time regarding trails. Would it be possible to add an option for the trails to behave like missile trails/engine contrails etc?

Because when you add a missile trail as an effect currently, it looks like this:
(https://ibin.co/3etVZCQaMNr5.png)
Title: Re: Particle effects - Cone not quite working right
Post by: m!m on October 24, 2017, 09:20:50 am
I'll have to look into how the engine handles trail rendering and management. In any case, you shouldn't use trail bitmaps for particles since particles have no "direction" which means that the engine has no way of rendering them properly.
Title: Re: Particle effects - Cone not quite working right
Post by: Spoon on October 24, 2017, 12:08:19 pm
Ah, I was afraid of that ):