Author Topic: Particle trail script  (Read 29234 times)

0 Members and 1 Guest are viewing this topic.

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
This could indeed come in handy, for example for a large torpedo takeoff with smoke coming out of the launcher.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
If you could define a negative velocity for it, it could be used for backlash from rocketlaunchers too.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Not completely related but I figured this would be as good of a place as any to ask.
m!m do you have any clue if its easy/possible to spawn particles on weapon fire (muzzleflashes)?

If yes to both and if you are feeling bored/have too much free time. Would you be willing to take a shot at that?  :D
Yes and it's even quite simple to do, sadly I won't be able to extend the script for the next three weeks as I'm not at home and I'm still waiting for my patch to be reviewed. But in general it rather easy to detect if a weapon has been created in the current frame and then create the specified effect.

If you could define a negative velocity for it, it could be used for backlash from rocketlaunchers too.
The script doesn't differentiate between negative and positive velocity entries so it should work just fine.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Sweet sauce

I'll just be patiently waiting until you return home and eventually get around to it (:
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
The config I'm using had +Creation raycast set to "YES" by default with +Raycast retries set to 5.  Should I set this number to something insanely high to prevent the explosions-outside-the-ship effect?  Also, for the box settings, do the three figures represent xyz distances for the box diameter?  So if I used 50 60 70, then the box would be 100 wide, 120 tall, and 140 long, right?
The Box values describe a volume that is defined by the two vectors you specify. So if you specify "100, 100, 100" and "-100, -100, -100" is would mean that the real position of the created particle will be inside the volume which is defined by the two vectors. That means that the X, Y and Z values of the resulting position vector will be randomized where each value will be between the vector values of the specified box vectors.
You also don't need to add the "+Raycast retries" option unless you see a message inside your fs2_open.log which says that no position for a particle could be found which will only happen if you have a very complicated model where a random ray is likely to miss.

Also, the config file I started with had the max box set to 200 200 0, and the min box set to -200 -200 0.  Will this cause the effects to be created on the surface of a 400 by 400 by 0 box, and not within it?
Actually if you use these values the particles will be created on a plane rather than inside a box as the resulting position of the particle can only have a Z value if 0.
OK.  I decided to adjust the figures that I had to try to expand the area where the particles were being spawned from.  I took the -200, -200, 0 and 200, 200, 0 that I had started with (which were in the config file that shipped with the scripts package) and replaced the "0"'s with -900 and 900 respectively.  At first things looked good, and from a side view the explosions were coming from most of the length of the Orion.  Unfortunately, when I chose an overhead view, I saw that explosions were spawning well out to the sides of the ship.  If the third figure in each set is the Z figure, then this shouldn't affect the left-to-right positioning of the spawn space.  What am I doing wrong?  :confused:
The Trivial Psychic Strikes Again!

 

Offline m!m

  • 211
OK.  I decided to adjust the figures that I had to try to expand the area where the particles were being spawned from.  I took the -200, -200, 0 and 200, 200, 0 that I had started with (which were in the config file that shipped with the scripts package) and replaced the "0"'s with -900 and 900 respectively.  At first things looked good, and from a side view the explosions were coming from most of the length of the Orion.  Unfortunately, when I chose an overhead view, I saw that explosions were spawning well out to the sides of the ship.  If the third figure in each set is the Z figure, then this shouldn't affect the left-to-right positioning of the spawn space.  What am I doing wrong?  :confused:
The left-to-right positioning is caused by the X range of -200 to 200. If you don't the particles to spawn to the sides of the ship then you have to set both coordinates to 0 to avoid this effect.
Also, do you have "+Creation raycast" set to YES?

 

Offline Nighteyes

  • 211
IMO a small change to the script is needed here, remove the bounding boxs completely, and leave us only with 2 options:
1. particles emmit from the  center(or a specific location, set by coordinates, 0,0,0 would mean the center of the ship) of the ship(raycast set to NO)
2. particles emmit from all over the hull(raycast set to YES)

I cant really see a point in emmiting particles from a place outside the ship... and I doubt anyone will ever use this to emmit particles only from a certain point of a ship...

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
I think that this could be usefull, for ships like Hades for instance, if you'd want particles to spew from engine blocks.

 

Offline m!m

  • 211
IMO a small change to the script is needed here, remove the bounding boxs completely, and leave us only with 2 options:
1. particles emmit from the  center(or a specific location, set by coordinates, 0,0,0 would mean the center of the ship) of the ship(raycast set to NO)
2. particles emmit from all over the hull(raycast set to YES)

I cant really see a point in emmiting particles from a place outside the ship... and I doubt anyone will ever use this to emmit particles only from a certain point of a ship...
I don't think that removing that option is a good idea as it can still be used to limit the raychecks to a specific area of the ship. What could be useful is a new option that would set the bounding box options automatically to the bounding box of the ship essentially causing the effects to be spawned from all over the hull when raycast is set to YES or just out of space when it is unspecified or set to NO.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
My name is The Trivial Psychic and I support this idea... which means that I think that its good and useful but can't actually do anything to further its creation or development.  :yes:

[Edited rather than posting again]
I have done further experimentation with increasing the Z figure (again, assuming that the 3rd figure in each box line is the Z distance) and have concluded that the code automatically tries to make the spawning area into a square, overriding the X distance that has been inputted.  Now, I say a "square", rather than a "cube", as it appears to respect the designated Y figures.  I even tried to make two spawn regions, one that extended 900-Z forward and 200 aft, and another that was 200 forward and 900 aft, and it still had the same result.  I'm hoping that the proposed auto-surface-explosions option becomes a reality, as I really think that combined deathroll mini-bangs and moment-of-death mega-bang particle spawning would make a welcome graphical addition to the Media VPs... if a way can be found to make them less memory-taxing.  :yes:
« Last Edit: August 03, 2011, 10:04:30 pm by Trivial Psychic »
The Trivial Psychic Strikes Again!

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
With this entry:

$Type:                Ship
$Class:             DD Ranger
   +Name:            Ranger
   +Effect:          ExpFlash
   +Time:             3
   +Emitstate:          2
   +Number:          80, 120
   +Speed:          35, 105
   +Size:             0.5, 2
   +Box Min:          -200, -200, -400
   +Box Max:          200, 200, 400
   +Spewcone:          90, 90, 90
   +FPS:            1, 3
   +Creation raycast:      YES
   +Raycast retries:      5
   +Trail:          ExplosionTrail
   
I've seen particles spawning outside the ship's hull.
The ship in question is about 250m tall, 250m wide and 700m long.
Also, "weapon" type doesn't seem to work,it always randomly spew dinky particles flying in corkscrew pattern (really!), regardless of actual settings.
EDIT: These dinky particles I mentioned turned out to be trails from tiny debris spawn when hitting ship's hull. So, "weapon" type simply does nothing.

 

Offline m!m

  • 211
With this entry:

$Type:                Ship
$Class:             DD Ranger
   +Name:            Ranger
   +Effect:          ExpFlash
   +Time:             3
   +Emitstate:          2
   +Number:          80, 120
   +Speed:          35, 105
   +Size:             0.5, 2
   +Box Min:          -200, -200, -400
   +Box Max:          200, 200, 400
   +Spewcone:          90, 90, 90
   +FPS:            1, 3
   +Creation raycast:      YES
   +Raycast retries:      5
   +Trail:          ExplosionTrail
   
I've seen particles spawning outside the ship's hull.
The ship in question is about 250m tall, 250m wide and 700m long.
The entry looks fine so the only reason I could imagine that particles spawn outside the ship could be that there is a bug in the script but I couldn't find anything that could cause your problems after a quick look at the script. I'm sorry but you will have to wait until I have a properly working FreeSpace install again which will in in less than two weeks.

Also, "weapon" type doesn't seem to work,it always randomly spew dinky particles flying in corkscrew pattern (really!), regardless of actual settings.
EDIT: These dinky particles I mentioned turned out to be trails from tiny debris spawn when hitting ship's hull. So, "weapon" type simply does nothing.
It worked when I did the last updates to the script which are still unreleased and it could be that the type could be broken in the version that is available to download. I will release the update as soon as possible as the necessary code is in trunk already.
You could post your entry here maybe there is a mistake inside it which prevents that the particles spawn properly

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
The entry was identical to one you provided in example config.

 

Offline m!m

  • 211
:banghead: You are right. In the current version the number of particles to be spawned still is calculated as particles per second which means that the specified 1 to 8 particles per second won't spawn as the effect is only active for one frame. You could try to increase the "+Number" value that should, at least temporary, fix this issue. It will also be fixed in the next version.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Code: [Select]
$Type: Weapon
$Class: MDU-57
+Effect: ExpFlash
+Time: 1
+Number: 9, 10
+Speed: 600, 800
+Size: 5, 10
+Spewcone: 90, 90, 90
+Add Velocity: NO
+Trail: ExplosionTrail

This still doesn't spew any particles.
Also, when one of multiple engines is disabled and thruster glow extinguishes, the particles remain.

BTW, could you add an option to define offset of a ship trail?
I also thought about a +contrail field, which would allow a trail to be enabled only if contrails are enabled in mission. It could have 3 possible values: NO (no dependancy) YES (when contrails are on) and DISABLE (enabled by default, disabled the contrails are enabled).

 

Offline m!m

  • 211
Code: [Select]
<snip>
This still doesn't spew any particles.
With a framerate of 60 FPS you would need to set the number to 60 so one particle would be created. As noted before this will be fixed in the next version.

Also, when one of multiple engines is disabled and thruster glow extinguishes, the particles remain.
I noticed that too but I currently don't know how get the associated engine subsystem but I can change the script so the particles stop spawning when all engine subsystems are destroyed.

BTW, could you add an option to define offset of a ship trail?
Yes, that's possible.

I also thought about a +contrail field, which would allow a trail to be enabled only if contrails are enabled in mission. It could have 3 possible values: NO (no dependancy) YES (when contrails are on) and DISABLE (enabled by default, disabled the contrails are enabled).
I don't know if the scripting interface offers access to this kind of information but it could be possible to be added.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
It would be great if this was added, as this would allow particle contrails, like in FreeFalcon. Also, contrails is just about the only thing this script can't yet replace with particle trails. One of my new ideas for Aces High reboot would be to ditch bitmap trails almost completely, at least in the "advanced" version (if everything goes as planned, the only use for trail bitmaps would be cannon tracers).
BTW, the script would also benefit greatly from allowing +Density: to be used on ship and weapon trails.

 

Offline m!m

  • 211
It would be great if this was added, as this would allow particle contrails, like in FreeFalcon. Also, contrails is just about the only thing this script can't yet replace with particle trails. One of my new ideas for Aces High reboot would be to ditch bitmap trails almost completely, at least in the "advanced" version (if everything goes as planned, the only use for trail bitmaps would be cannon tracers).
BTW, the script would also benefit greatly from allowing +Density: to be used on ship and weapon trails.
You must be careful with the excessive use of particles as the performance of particles if FSO is awful. The script can be configured so it won't spawn new particles and cuts down the calculations of the script if the framerate is below a given value.
Density manipulation will be added when I'm back home :nod:

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
I know about performance issues, that's why I said it'd be in advanced version. Also, particles in FSO tend to look bad at lower framerates. I think that bitmap trails could be used "under" particles, which will stop spewing once framerate drops to the "ugly" point.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
I've just found that when using large thruster flames for ships, they look weird.

It looks as if instead spawning in the center of the thruster point, particles are created in random points in the entire radius, resulting in them sometimes being created at the very edge of the point, which looks weird. Could you implement some way to prevent them from doing that? I'd like to create a more or less uniform thruster flame, without an occasional particle "escaping" from the main flow.